Reputation: 1072
I'm new to web development. Currently I'm facing a problem with the text alignment in the carousel.
The JS fiddle is here. http://jsfiddle.net/QYMZb/
The problem with it is that the text would vertically align top first before align center while sliding. I think I'm doing something wrong here.
<div id="myCarousel" class="carousel slide" style="width:400px; height:200px;"> <!-- slider -->
<ol class="carousel-indicators middle">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner row-padded">
<div class="item active" style="width:340px; height:120px;">
"fdfdsfdsfds fsfsdf sfsdfs fasf sasdfasdf asdfasdf asdfasdfas sdfafs"
</div>
<div class="item" style="width:340px; height:120px;">
" asdfsadfasd fasdfasdfasd fasdfas dfasdfasdf asdfasfdsa"
</div>
<div class="item" style="width:340px; height:120px;">
fsfafdsfas asd fsa f as fas f asdf asdfasdf asdf as fa sdf asf sd asdf asdf asdfa sdf asd f asd sda
</div>
</div>
</div>
</div>
</div>
Thanks.
Upvotes: 0
Views: 138
Reputation: 5812
During transition, your new active div.item receives a position absolute from the class prev or next. This class is assigned few seconds.
.carousel-inner > .next, .carousel-inner > .prev {
position: absolute;
top: 0;
width: 100%;
}
That is the reason of the problem.
The real problem is that .carousel-inner is not intended to have a padding. To get the padding style you must give the padding to the .carousel or wrap your .carousel-inner inside a padded div.
<div id="myCarousel" class="carousel slide row-padded">
<div class="carousel-inner">
</div>
</div>
Upvotes: 1