css - 我怎样才能得到像瑞典 HTML 中的国旗一样的黄线

标签 css html

我是 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>

(瑞典国旗的图片)

enter image description here

最佳答案

不是表格而是 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/

相关文章:

html - 为什么我的搜索栏中的占位符文本没有出现在 Firefox 中

html - 如何使用内联 css 对文本执行双删除线?

javascript - 如何将 TogetherJS 用作聊天应用程序?

html - 向现有 HTML 添加行号

css - 使用 CSS 动画比例 - 具有多个背景

javascript - 平滑滚动在所有设备上的性能并不恒定

css - 带圆 Angular 和纯 css 的梯形

javascript - 确定子 div 是否有内容

html - 段落内的 anchor 内的图形 : is it legal in HTML5?

css - 为什么用outlook打开我的邮件末尾有问号