开发者

Adjust divs in div

开发者 https://www.devze.com 2023-01-25 21:11 出处:网络
I have a div and 5 divs in it. <div style=\"width: 1000px\"> <div style=\"float: left; width: 50px;\"></div>

I have a div and 5 divs in it.

<div style="width: 1000px">
 <div style="float: left; width: 50px;"></div>
 <div style="float: l开发者_StackOverflow中文版eft; 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.


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消