gpt4 book ai didi

html - CSS 中的三个水平条纹

转载 作者:太空宇宙 更新时间:2023-11-03 23:10:55 25 4
gpt4 key购买 nike

我创建了三个水平条纹来创建一个将在我的页面顶部运行的扩展标志:

CSS

#main1 div{
width: auto;
height: 20px;
margin: 0px

HTML

<div id="main1">
<div style="background-color:red;"></div>
<div style="background-color:blue;"></div>
<div style="background-color:orange;"></div>

如何让它贴在浏览器的边缘?(如左右或顶部没有间隙)

还有什么更简单/更好的方法我可以做到这一点请记住,我是一个新手

非常感谢您的帮助!谢谢

最佳答案

htmlbody 元素中移除所有 marginpadding,然后使用单个 div linear-gradient 作为背景

示例:http://codepen.io/anon/pen/rOxEgJ

html, body { margin: 0; padding: 0 }


#flag {
height : 100px;
width : 100%;
background: linear-gradient(to bottom,
red 0%, red 33.33%,
blue 0%, blue 66.66%,
orange 0%);
}

关于html - CSS 中的三个水平条纹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32607835/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com