[英]How do I get the caption text of the jQuery to align with the image?
我對傳送帶有問題。 我想使標題與圖像具有相同的寬度,但現在將其設置為與內部項類相同的寬度。
我得到以下效果:
有沒有一種方法可以將標題設置為居中(並與圖像對齊)?
我的標記是:
<div id="myCarousel" class="carousel slide">
<!-- Carousel items -->
<div class="carousel-inner">
<div class="active item">
<div class="inner-item">
<img src="img/1.jpg">
</div>
<div class="carousel-caption">
<p>Caption</p>
</div>
</div>
<div class="item">
<div class="inner-item">
<img src="img/1.jpg">
</div>
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
<div class="item">
<div class="inner-item">
<img src="img/1.jpg">
</div>
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
</div>
<!-- Carousel nav -->
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>
如果我正確理解您的問題,為什么不使用text-align:center;
用於標題,並將寬度更改為圖像的寬度
.carousel-caption
{
text-align:center;
width:800px;
/*If you are having aligning problems and the position is absolute or relative use left:some_number px or margin if not absolute */
}
我希望這可以幫助:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.