Question

I want to make something like airbnb

This is my carousel code using twitter bootstrap.

<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
             <!-- Indicators -->
    <ol class="carousel-indicators">
         <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
         <li data-target="#carousel-example-generic" data-slide-to="1"></li>
         <li data-target="#carousel-example-generic" data-slide-to="2"></li>
    </ol>


     <!-- Wrapper for slides -->
    <div class="carousel-inner">
        <div class="item active">
          <img src="rio.jpg" alt="">
        </div>
        <div class="item">
          <img src="rio.jpg" alt="">
        </div>
        <div class="item">
          <img src="rio.jpg" alt="">
        </div>  
    </div>
    <!-- Controls -->
   <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
       <span class="glyphicon glyphicon-chevron-left"></span>
   </a>
   <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
       <span class="glyphicon glyphicon-chevron-right"></span>
   </a>
</div>

This is the form layout that I have created.

    <div class="form-group">    
        <div class="container">
            <div class="row">
            <div class="col-md-6">
                <input type="text" class="form-control input-lg" placeholder="Where do you wanna go?">  
            </div>
            <div class="col-md-2">
                <input type="date" class="form-control input-lg" name="start" placeholder="Check In">   
            </div>
            <div class="col-md-2">
                <input type="date" class="form-control input-lg" name="end" placeholder="Check Out">            
            </div>
            <div class="col-md-2">
                <a class="btn btn-lg btn-success" href="#" role="button">GO</a>
            </div>
            </div>
        </div>
    </div>

Here's what I tried.

.form-group{
   margin-top: -250px;
}

But it didn't work. Please help me.

Was it helpful?

Solution

Move the "form-group" div to the top of the carousel div. Like this:

<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
    <div class="form-group">    
    ....
    </div>
    other carousel html here...
</div>

Then add this css:

div#carousel-example-generic {
    position:relative;
}

div.form-group {
    position:absolute;
    z-index:9999999;
    top:20px; /* change to whatever you want */
    left:10px; /* change to whatever you want */
    right:auto; /* change to whatever you want */
    bottom:auto; /* change to whatever you want */
}

This will work in all browsers (IE6+).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top