rakete
rakete

Reputation: 3041

Adjust divs in div

I have a div and 5 divs in it.

<div style="width: 1000px">
 <div style="float: left; width: 50px;"></div>
 <div style="float: left; width: 50px;"></div>
 <div style="float: left; width: 50px;"></div>
 <div style="float: left; width: 50px;"></div>
 <div style="clear: both;"></div>
</div>

Now i want to adjust the inner divs to the right.

Upvotes: 0

Views: 375

Answers (2)

Marcus Hansson
Marcus Hansson

Reputation: 816

Try giving the parent div a padding-left, as such:

<div style="width: 1000px;padding-left:100px">
 <div style="float: left; width: 50px;"></div>

Or you can try positioning each element by their own, with margin-left:

<div style="width: 1000px;">
 <div style="float: left; width: 50px;margin-left:100px"></div>

Some resources:

http://www.w3schools.com/css/css_margin.asp
http://www.w3schools.com/css/css_padding.asp

Upvotes: 1

J V
J V

Reputation: 11936

Give the parent div a padding-left: 50px insert whatever size you want.

If you want them centered, put them in another div, and center that div inside the original parent.

Upvotes: 1

Related Questions