【发布时间】:2014-09-11 23:00:09
【问题描述】:
是否可以使用 CSS 制作橙色的双竖线形状? (见下图)。这是我网站上的一个推荐部分,它必须与文本一起垂直扩展。
非常感谢!
【问题讨论】:
-
这很容易。给我一分钟..
-
@KheemaPandey Pandey - 不够好。它们没有对齐。
标签: css shape css-shapes
是否可以使用 CSS 制作橙色的双竖线形状? (见下图)。这是我网站上的一个推荐部分,它必须与文本一起垂直扩展。
非常感谢!
【问题讨论】:
标签: css shape css-shapes
css
#trapezoid {
border-bottom: 15px solid transparent;
border-right: 15px double orange;
min-height: 50px;
width: 0;
}
span {
font-family: calibri;
font-size: 28px;
font-weight: bold;
margin-left: 20px;
height: 50px;
width: 500px;
display: block;
color: blue;
}
【讨论】:
这个例子是最好的例子,不管他们有什么背景,或者页面有什么。它会自动扩展。尝试在 Playground 演示页面中编写文本并查看!
<div class='striped'>
<p contenteditable>
Is it possible to make that orange double vertical line shape with CSS?
(see image bellow). This is for a testimonials section on my site that has
to expand vertically along with the text. try editing this test and watch!
</p>
</div>
.striped{
font-size:20px;
padding:0 0 10px 3.5em;
width:350px;
position:relative;
}
.striped::before{
content:'';
position:absolute;
left:10px; top:0; bottom:0;
border-right:26px double orange;
border-bottom:26px solid transparent;
}
【讨论】:
这可以使用after 和:before 伪元素来实现。但是,此示例与发布的图像不准确,但这是一种方法。检查DEMO。
h1{
border-left:5px solid gold;
padding:15px;
position:relative;
height:auto;
border-bottom:5px solid transparent;
}
h1:after{
content:"";
position:absolute;
top:0;
left:6px;
border-left:5px solid gold;
padding:15px;
height:30%;
border-bottom:5px solid transparent;
}
【讨论】:
这样的?
div#one {
height: 100px;
margin-right: 5px;
border-right: 10px solid orange;
border-bottom: 10px solid transparent;
}
div#two {
height: 150px;
border-right: 10px solid orange;
border-bottom: 10px solid transparent;
}
div {
width: 10px;
float: left; /* To make them appear next to each other */
}
【讨论】: