1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00

refactor some of the carousel caption stuff to center it and tighten styles up; update carousel template to start to redo mobile first

This commit is contained in:
Mark Otto 2013-04-02 16:17:04 -07:00
parent 0f51a750a8
commit 0ac711059b
4 changed files with 71 additions and 59 deletions

View file

@ -5137,13 +5137,14 @@ a.list-group-item.active > .badge,
.carousel-caption {
position: absolute;
right: 20%;
right: 15%;
bottom: 20px;
left: 20%;
display: none;
left: 15%;
z-index: 10;
padding-top: 20px;
padding-bottom: 20px;
color: #fff;
text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
@ -5160,14 +5161,7 @@ a.list-group-item.active > .badge,
font-size: 30px;
}
.carousel-caption {
right: 0;
left: 0;
z-index: 10;
display: block;
max-width: 60%;
padding: 30px;
margin-right: 0;
margin-left: 0;
padding-bottom: 30px;
}
}

View file

@ -6304,21 +6304,21 @@ $('#myCollapsible').on('hidden', function () {
<img data-src="holder.js/900x500/auto/#777:#777" alt="">
<div class="carousel-caption">
<h3>First slide label</h3>
<p>Nulla vitae elit libero, a pharetra augue. Maecenas faucibus mollis interdum. Cum sociis natoque penatibus et magnis dis parturient montes.</p>
<p>Nulla vitae elit libero, a pharetra augue mollis interdum.</p>
</div>
</div>
<div class="item">
<img data-src="holder.js/900x500/auto/#777:#777" alt="">
<div class="carousel-caption">
<h3>Second slide label</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean lacinia bibendum nulla sed consectetur. Nullam quis risus eget urna mollis ornare.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
<div class="item">
<img data-src="holder.js/900x500/auto/#777:#777" alt="">
<div class="carousel-caption">
<h3>Third slide label</h3>
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.</p>
<p>Praesent commodo cursus magna, vel scelerisque nisl consectetur.</p>
</div>
</div>
</div>

View file

@ -27,11 +27,10 @@ body {
left: 0;
right: 0;
z-index: 10;
margin-top: 20px;
margin-bottom: -90px; /* Negative margin to pull up carousel. 90px is roughly margins and height of navbar. */
}
/* CUSTOMIZE THE CAROUSEL
-------------------------------------------------- */
@ -39,12 +38,12 @@ body {
.carousel {
margin-bottom: 60px;
}
.carousel .container {
position: relative;
z-index: 9;
/* Since positioning the image, we need to help out the caption */
.carousel-caption {
z-index: 10;
}
/* Declare heights because of positioning of img element */
.carousel .item {
height: 500px;
}
@ -56,26 +55,21 @@ body {
height: 500px;
}
.carousel-caption {
background-color: transparent;
position: static;
max-width: 550px;
padding: 0 20px;
margin-top: 200px;
}
.carousel-caption .btn {
margin-top: 10px;
}
/* MARKETING CONTENT
-------------------------------------------------- */
/* Pad the edges of the mobile views a bit */
.marketing {
padding-left: 15px;
padding-right: 15px;
}
/* Center align the text within the three columns below the carousel */
.marketing .col-span-4 {
text-align: center;
margin-bottom: 20px;
}
.marketing h2 {
font-weight: normal;
@ -121,7 +115,35 @@ body {
/* RESPONSIVE CSS
-------------------------------------------------- */
@media (max-width: 979px) {
@media (min-width: 768px) {
/* Remve the edge padding needed for mobile */
.marketing {
padding-left: 0;
padding-right: 0;
}
/* Navbar positioning foo */
.navbar-wrapper {
margin-top: 20px;
margin-bottom: -90px; /* Negative margin to pull up carousel. 90px is roughly margins and height of navbar. */
}
/* The navbar becomes detached from the top, so we round the corners */
.navbar-wrapper .navbar {
border-radius: 4px;
}
/* Bump up size of carousel content */
.carousel-caption p {
margin-bottom: 20px;
font-size: 21px;
line-height: 1.4;
}
}
/*@media (max-width: 979px) {
.container.navbar-wrapper {
margin-bottom: 0;
@ -189,7 +211,7 @@ body {
font-size: 18px;
line-height: 1.5;
}
.navbar-wrapper {
margin-top: 0;
}
@ -197,12 +219,12 @@ body {
.navbar {
border-radius: 0;
}
#myCarousel {
margin-top: 54px;
}
}
}*/
</style>
@ -212,7 +234,7 @@ body {
<div class="navbar-wrapper">
<div class="container">
<div class="navbar navbar-inverse">
<div class="navbar navbar-inverse navbar-static-top">
<div class="container">
<a class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
@ -257,32 +279,32 @@ body {
</ol>
<div class="carousel-inner">
<div class="item active">
<img data-src="holder.js/1500x550/auto/#777:#fff/text:First slide" alt="">
<img data-src="holder.js/1500x500/auto/#777:#7a7a7a/text:First slide" alt="">
<div class="container">
<div class="carousel-caption">
<h1>Example headline.</h1>
<p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<a class="btn btn-large btn-primary" href="#">Sign up today</a>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-large btn-primary" href="#">Sign up today</a></p>
</div>
</div>
</div>
<div class="item">
<img data-src="holder.js/1500x550/auto/#777:#fff/text:Second slide" alt="">
<img data-src="holder.js/1500x500/auto/#777:#7a7a7a/text:Second slide" alt="">
<div class="container">
<div class="carousel-caption">
<h1>Another example headline.</h1>
<p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<a class="btn btn-large btn-primary" href="#">Learn more</a>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-large btn-primary" href="#">Learn more</a></p>
</div>
</div>
</div>
<div class="item">
<img data-src="holder.js/1500x550/auto/#777:#fff/text:Third slide" alt="">
<img data-src="holder.js/1500x500/auto/#777:#7a7a7a/text:Third slide" alt="">
<div class="container">
<div class="carousel-caption">
<h1>One more for good measure.</h1>
<p class="lead">Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<a class="btn btn-large btn-primary" href="#">Browse gallery</a>
<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
<p><a class="btn btn-large btn-primary" href="#">Browse gallery</a></p>
</div>
</div>
</div>
@ -304,13 +326,13 @@ body {
<div class="col-span-4">
<img class="img-circle" data-src="holder.js/140x140">
<h2>Heading</h2>
<p>Donec sed odio dui. Etiam porta sem malesuada magna mollis euismod. Nullam id dolor id nibh ultricies vehicula ut id elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
<p>Donec sed odio dui. Etiam porta sem malesuada magna mollis euismod. Nullam id dolor id nibh ultricies vehicula ut id elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna.</p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!-- /.col-span-4 -->
<div class="col-span-4">
<img class="img-circle" data-src="holder.js/140x140">
<h2>Heading</h2>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
<p>Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh.</p>
<p><a class="btn" href="#">View details &raquo;</a></p>
</div><!-- /.col-span-4 -->
<div class="col-span-4">

View file

@ -155,13 +155,14 @@
// Hidden by default for smaller viewports
.carousel-caption {
position: absolute;
left: 20%;
right: 20%;
left: 15%;
right: 15%;
bottom: 20px;
display: none;
z-index: 10;
padding-top: 20px;
padding-bottom: 20px;
color: #fff;
text-align: center;
text-shadow: 0 1px 2px rgba(0,0,0,.6);
& .btn {
text-shadow: none; // No shadow for button elements in carousel-caption
@ -183,13 +184,8 @@
// Show and left align the captions
.carousel-caption {
left: 0;
right: 0;
z-index: 10;
display: block;
max-width: 60%;
padding: 30px;
margin-left: 0;
margin-right: 0;
left: 20%;
right: 20%;
padding-bottom: 30px;
}
}