我有帶圖標的Bootstrap 3警報。我使用圖標字體來維護圖標。當警報消息長度用一行代表時,我沒有問題,但是當它超出一行時,我遇到了圖標對齊的問題。下面的屏幕截圖說明了問題: 在與多行對齊消息之前使用僞引導警報消息
我需要什麼有,在第二個框,栗色行應啓動和包裝盒上的水平邊界和文本將是在右邊結束。換句話說,隨着文本行數的增加,栗色邊框的高度也增加,圖標垂直對齊保持在中間。
下面是HTML:
<div class="alert alert-warning">
<h4>This property contains system-sensitive properties. Do not use it unless you are well aware of their requirements and results. </h4>
</div>
這裏是有關`DIV警告所有的CSS規則:
.alert-warning {
padding-left: unset;
}
.alert {
padding: 0 5px;
}
.alert-warning {
background-color: #F8AA5D;
border-color: #f7864e;
color: #795548;
}
.alert {
border: 1px solid transparent;
border-radius: 4px;
}
.alert, .thumbnail {
margin-bottom: 20px;
}
.alert-warning:before {
display: inline-block;
font-size: 320%;
font-family: fox;
text-align: center;
padding: 0 10px;
vertical-align: middle;
border-right: 5px solid;
margin: 0 10px;
.alert-warning:before {
content: "\e817";
color: #772953;
text-shadow: 0 1px 5px rgba(185,74,72,.79);
}
這是h4
CSS:
.alert h4, .alert h5 {
display: inline-block;
padding: 0;
margin: 0;
}
.alert h4 {
color: inherit;
}
.alert h4 {
margin-top: 15px!important;
}
一種可能的方案可以被宣佈上'.alert h4'一個'MAX-width':https://codepen.io/anon/pen/WZYjXa – UncaughtTypeError
正如羅伯特瓦德暗示, https://codepen.io/anon/pen/eGQWwp @UncaughtTypeError – SaidbakR