【发布时间】:2016-06-16 14:09:09
【问题描述】:
我有一个这样的酒吧:
<div class="traffic-info-bar" ng-if="hasTrafficInfo" ng-click="openTrafficInfoModal()">
<span class="icon ion-alert-circled"></span>
<span class="traffic-info-main-text">This is a very long placeholder text</span>
<span class="traffic-info-read-more">Read more</span>
</div>
使用 CSS:
.traffic-info-bar {
text-transform: uppercase;
font-weight: bold;
color:#fff;
text-align:center;
background-color: #007aff;
height: 40px;
padding-top: 12px;
}
.traffic-info-main-text {
overflow-x: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.traffic-info-read-more {
font-size: 10px;
text-decoration: underline;
}
这是小屏幕上的结果(iPhone 5):
如您所见,您几乎可以在蓝色条的底部看到“阅读更多”文字。这是我想要的示例。
谁能看到我如何解决这个问题?
【问题讨论】:
-
stackoverflow.com/questions/17779293/… 的可能重复项。您的元素是
span,它是一个内联元素,而您没有width。
标签: html css overflow word-wrap