BitmapAndroid
BitmapAndroid

Reputation: 37

How to center a div and position another div to the right?

I am having an issue with positioning a div in the middle and floating another div to the right of it. The div contains a select element and keeps going onto a new line.

I have tried many things. I would like the divs to be side by side and not to collapse when the page is minimized.

I tried to float the div with the id theme right but it pushes it onto a new line.

#theme {
    float: right;
}

You can see my problem in this JsFiddle

The desired solution looks like this:

Image of desired solution

Upvotes: 3

Views: 101

Answers (1)

Manish
Manish

Reputation: 1447

You can do it this way , wrap both select & nav in a div of fixed width and give theme class a width . It will position the divs like the image

<div class="wrap">    
<!-- all html here -->    
</div>

.theme
{
    float: right;
    width:100px; //say 100
}

 .wrap{
     width:1100px;
     margin:0 auto
   }

Demo: http://jsbin.com/IYifEN/1

Upvotes: 3

Related Questions