我希望此特定HR的寬度與其上的任何屏幕大小上的「較大的頭像」相同。我對的245px小時的默認寬度,但對於這個特殊的一個,我想是因爲上面的文字的寬度爲任何屏幕尺寸如何使HR元素與它上面的文本的寬度相同
hr {
border-top: 0px solid blue !important;
padding: 0;
margin-top: 0.5em !important;
border-width: 6px !important;
width: 245px;
}
<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row text-center">
<h1>HEADER 1</h1>
</div>
<div class="row text-center">
<h1>LARGER HEADER LIKE THIS</h1>
<hr>
</div>
添加樣式只有標籤。
– tech2017