首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >段落的一侧边框

段落的一侧边框
EN

Stack Overflow用户
提问于 2015-07-03 18:33:44
回答 2查看 58关注 0票数 3

我正在试着用:课前显示一个段落的左边框。

但产出似乎与我想要实现的略有不同。

代码:

代码语言:javascript
复制
p.left-border::before {
    border-left: 3px solid #9e9464;
    content:"";
    padding: 0 20px 0 0;
    vertical-align: middle;
}
p {
    line-height:30px;
}
代码语言:javascript
复制
 <h4>Our Unique Approach</h4>

<p class="left-border">Aspire to Acheive is unlike anything you’ve ever experienced. The Fellowship brings together some of the world’s most creative and motivated young people, and helps them bring their most ambitious projects to life. Thiel Fellows are given a grant of $100,000 to focus on their work, their research, and their self-education while outside of university.</p>

以下是我迄今所做工作的演示链接。

下面是我想要达到的目标的截图:

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-07-03 18:39:35

也许是吧?

代码语言:javascript
复制
p {
    line-height:30px;
    padding-left: 20px;
    position: relative;
}
p.left-border::before {    
    content:"";
    position: absolute; top: 10px; left: 0;    
    vertical-align: middle;
    height: 60%;
    width: 5px;
    background: #9e9464;
}
代码语言:javascript
复制
<h4>Our Unique Approach</h4>

<p class="left-border">Aspire to Acheive is unlike anything you’ve ever experienced. The Fellowship brings together some of the world’s most creative and motivated young people, and helps them bring their most ambitious projects to life. Thiel Fellows are given a grant of $100,000 to focus on their work, their research, and their self-education while outside of university.</p>

票数 3
EN

Stack Overflow用户

发布于 2015-07-03 18:39:43

这可以通过定位前元素absolute实现,如下所示:http://jsfiddle.net/e12pk3bp/2/

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31212579

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档