html - css3 渐变,顶部有线条

标签 html css

<分区>


想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post .

关闭 5 年前

所以我正在尝试为我正在制作的网站制作信息图表,我想制作一个顶部有一条线的渐变,如下图所示:https://ibb.co/e8xmCk上面有一个渐变和一条不同颜色的线,它是一个特定地方的背景。非常感谢!

最佳答案

其实我真的无法理解你的问题,但是 尽管如此,我还是做了一个你想要的解决方案......

.container {width: 100%; height: 200px; background: linear-gradient(to right, rgba(0,0,0,1), rgba(0,0,0,0)); position: relative; box-sizing: border-box; z-index: 1;}
.container:before {display: block; content: ""; height: 10%; width: 100%; background: red; position: absolute; top: 0px; left: 0px; z-index: -1;}
h1 {font-family: Arial; font-size: 49px; font-weight: bold; color: #fff; text-align: center; margin: 0px;}
<div class="container">
	<h1>This is text here..!</h1>
</div>

还有一个在这里...

.container {width: 100%; height: 200px; background: linear-gradient(to right, rgba(0,0,0,1), rgba(0,0,0,0)); position: relative; box-sizing: border-box; z-index: 1; overflow-y: hidden;}
.container:before {display: block; content: ""; height: 10%; width: 100%; background: red; position: absolute; top: 0px; left: 0px; z-index: -1;}
.side-panel {height: 100%; width: 30%; position: absolute; top: 0px; left: -10%; background: #2493a4; z-index: -2; transform: skew(20deg);}
h1 {font-family: Arial; font-size: 49px; font-weight: bold; color: #fff; text-align: center; margin: 0px;}
<div class="container">
	<div class="side-panel"></div>
	<h1>This is text here..!</h1>
</div>

关于html - css3 渐变,顶部有线条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44819257/

上一篇:javascript - D3 中轴文本的背景颜色

下一篇:HTML,将 div 彼此靠近放置

相关文章:

javascript - 使用 css after 时,光标不会出现在嵌套的 contenteditable 结构中的 chrome 中

css - 使用 css 将 2D Logo 转换为 3D?

html - iPhone 5S Mobile Safari 超链接不是 'clickable'

html - 需要截断img左右

php - 快速 Web 应用程序开发的最佳实践是什么?

html - 为什么 Chrome 和 Safari 中的大小不同(媒体查询问题)

Javascript appendChild (div) : confusion

css - 通过 css 悬停时的 ASP.Net 图像

javascript - 在不使用任何 javascript 的情况下在 jquery 中动态删除文本框

html - IE11 中的边框折叠和 colspan