我是 html 和 css 的新手,所以我不是很好。我现在遇到的问题是我创建了一个包含两个表的嵌套表。我有四列蓝色。但问题是我不知道如何像旗帜那样获得黄线。我到目前为止的代码如下。
<!DOCTYPE html>
<html>
<head>
<style>
table.blue {background-color: #0000ff;}
table.yellow {background-color: #ffff00;}
</style>
<title>HTML Table</title>
</head>
<body>
<table class="yellow" border="10" width="320px">
<tr>
<td>
<table class="blue" border="1" width="100%">
<tr>
<td height="40">blue</td>
<td>blue</td>
</tr>
<tr>
<td height="40">blue</td>
<td>blue</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
</body>
</html>
(瑞典国旗的图片)
最佳答案
不是表格而是 div https://jsfiddle.net/2Lzo9vfc/134/
CSS
.flag {
background-color: #006AA7;
width: 500px;
height: 300px;
position: relative;
}
.flag::before {
background-color: #FECC00;
content: "";
height: 15%;
left: 0;
margin-top: -5%;
position: absolute;
top: 50%;
width: 100%;
}
.flag::after {
background-color: #FECC00;
content: "";
height: 100%;
left: 30%;
margin-left: -5%;
position: absolute;
top: 0;
width: 9%;
}
HTML
<div class="flag"></div>
关于css - 我怎样才能得到像瑞典 HTML 中的国旗一样的黄线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33829458/