[英]Show text on next line within the inline elements
Can you tell me how to break the date to next line? 你能告诉我如何将日期推迟到下一行吗? I have tried many ways. 我尝试了很多方法。 But no luck. 但是没有运气。
I tried this. 我试过了 But no effect. 但是没有效果。
.not:after {
content: '\A';
white-space: pre;
}
.html html的
<p class="not">{{item.domain}}
<em>{{item.date | date:'yyyy-MM-dd'}}</em>
<span>
${{item.price}}
</span>
</p>
.scss .scss
.not {
line-height: 48px;
padding: 5px 10px 5px 15px;
height: 55px;
background: white;
border-radius: 5px;
border-bottom: 1px solid #56cde0;
font-weight: bold;
width: 90%;
}
.not span {
float: right;
color: #9bb0bf;
font-weight: normal;
font-size: 16px;
}
UI UI
You are almost good, simply apply the \\A
trick to the em
pseudo element 您几乎不错,只需将\\A
技巧应用于em
伪元素
.not em:before { content: '\\A'; white-space: pre; } .not { line-height: 18px; /*Updated this*/ padding: 5px 10px 5px 15px; height: 55px; background: white; border-radius: 5px; border-bottom: 1px solid #56cde0; font-weight: bold; width: 90%; } .not span { margin-top:-15px; /*If you want to keep the price on the top*/ float: right; color: #9bb0bf; font-weight: normal; font-size: 16px; }
<p class="not">domain.com <em>1990-10-10</em> <span> $8000 </span> </p>
Use display: block;
使用display: block;
to em
到em
.not { height: 55px; background: white; border-radius: 5px; border-bottom: 1px solid #56cde0; font-weight: bold; width: 90%; } .not span { float: right; color: #9bb0bf; font-weight: normal; font-size: 16px; } em{ display: block; font-size: 12px; }
<p class="not">thesite.com <span> $8800 </span> <em>2018-10-10</em> </p>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.