【发布时间】:2018-10-12 20:54:24
【问题描述】:
我正在尝试为页面上的侧边栏获得垂直效果。我试过 deg 选项,但它仍然显示一条水平线
.sidebar {
position: relative;
display: inline-block;
padding: 15px 25px;
background-image: linear-gradient(90deg, #1559EC, #1559EC);
color: #fff;
font-size: 36px;
font-family: Arial;
border-radius: 3px;
box-shadow: 0px 1px 4px -2px #333;
text-shadow: 0px -1px #333;
}
.sidebar:after {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: calc(100% - 4px);
height: 50%;
background: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.2));
}
<div class="sidebar">
The quick brown fox
</div>
【问题讨论】:
-
结果应该是什么样子?
-
如果您不想学习语法细节,为什么不直接使用a generator?
-
渐变不是从左到右,而是从上到下
-
linear-gradient(to top, #1559EC, #1559EC);或linear-gradient(to bottom, #1559EC, #1559EC);
标签: html css linear-gradients