Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS Framework Basics Prototyping with Bootstrap Building a Carousel

How to control the width an height of my carousel

Hello,

1) Would you happen to know how to manipulate the width of this carousel.

I am able to get the width to cut in half with this stlye, but I really want to change the height so that my pictures in this carousel don't that the entire height of the screen.

How can I change the height of this carousel?

2) Would you happen to know a good site to pick background colors. I find the color wheel in www.w3schools.com to be a bit limited.

thanks

 .jumbotron{
     width:50%;
     height:50%;

     }
<!DOCTYPE html>
<html>
  <head>
    <title>Ribbit - A Treehouse Project</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="css/bootstrap-theme.min.css" rel="stylesheet" media="screen">
    <link href="css/my-styles.css" rel="stylesheet" media="screen">
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="../../assets/js/html5shiv.js"></script>
      <script src="../../assets/js/respond.min.js"></script>
    <![endif]-->
    <style>
     .jumbotron{
     width:50%;
     height:50%;

     }
        .carousel-indicators{
        bottom:0;
        }
        .carousel-indicators .active{
         background-color:#222;
        }
        .carousel-indicators li{
         border-color:#222;
        }

    </style>
  </head>
  <body>

    <!-- Navbar -->
    <div class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">

      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand text-muted" href="#">Ribbit</a>
      </div>


        <div class="collapse navbar-collapse">
          <ul class="nav navbar-nav navbar-right">
            <li class="active"><a href="#">Home</a></li>
            <li><a href="#">About Ribbit</a></li>
            <li class="dropdown">
              <a data-toggle="dropdown" data-target="#">Treehouse<b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li><a href="#">About Treehouse</a></li>
                <li><a href="#">Video Library</a></li>
                <li><a href="#">Learning Adventures</a></li>
                <li class="divider"></li>
                <li><a href="#">Plans &amp; Pricing</a></li>
              </ul>
            </li>
          </ul>
        </div>
      </div>
    </div><!-- End navbar -->
    <div id="myCarousel"class="carousel slide jumbotron">
        <div class="container">
            <ol class="carousel-indicators">
                <li data-target="#myCarousel" data-slide-to="0"></li>
                <li data-target="#myCarousel" data-slide-to="1"></li>
                <li data-target="#myCarousel" data-slide-to="2"></li>
            </ol>
            <div class="carousel-inner">
                <div class="item active">
                    <h1>Self-destructing message app</h1>
                    <p class="lead">Learn how to build this fun little app by signing up for a Treehouse account today! We'll teach you how to build both apps from scratch!</p>
                    <p class="btn-group">
                      <a class="btn btn-success btn-lg" href="#">Download the app</a>
                       <a class="btn btn-default btn-lg hidden-xs" data-toggle="modal" href="#textModal">Text me the link</a>
                    </p> 

                </div>
                <div class="item">
                    <h1>Learn how to build it for iOS</h1>
                    <p class="lead">We'll teach you how to build it from scratch!</p>
                    <p>
                    <a class="btn btn-success btn-lg" href="#">Get started today!</a>
                    </p>

                </div>

                <div class="item">
                    <h1>Learn how to build it for Android</h1>
                    <p class="lead">We'll teach you how to build it from scratch!</p>
                      <p>
                        <a class="btn btn-success btn-lg" href="#">Get started today!</a>
                      </p> 

                </div>
            </div>
        </div>
     <a class="left carousel-control" href="#myCarousel" data-slide="prev">
        <span class="icon-prev"></span>
    </a>

    <a class="right carousel-control" href="#myCarousel" data-slide="next">
        <span class="icon-next"></span>
    </a>
    </div> <!--End Carousel -->


      <hr>
      <div class="pull-right">
        <p>&copy; 2013 Ribbit - By Treehouse Island, Inc.</p>
      </div>
    </div>
    <script src="http://code.jquery.com/jquery.js"></script>
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

4 Answers

1) You can apply a height to the container div that is holding the images. You could also try applying a max-height to the jumbotron class.

2) I find Adobe Kuler to be the best solution for color schemes.

David Kilgallon
David Kilgallon
6,697 Points

Hi Mate, Try using the same css code, but for the "container" <div> instead of jumbotron.

Hope this is of a little help.

If none of this helps, go to stackoverflow.com, somebody on there may be able to help.

Hello Mark,

I just tried this, but it doesn work for height or ming-height. I can change the value for the width without a problem, but the height, it doesn't budge.

.jumbotron{ width:100%; max-height:25%;

}

thanks

Thanks David, I found the answer in stackoverflow.com.

David Kilgallon
David Kilgallon
6,697 Points

That's great glad you sorted it, I use stack overflow a lot for any issues I run into.

can you share the solution please?