您的位置:首页 > 其它

Center parent div with dynamic and set width child divs

2014-12-12 03:37 471 查看
http://stackoverflow.com/questions/26317115/center-parent-div-with-dynamic-and-set-width-child-divs

Centering a Div of Unknown Width

When the div widths are variable, the centering technique below works well. It uses an outer and inner wrapper.

The outer wrapper div is set to text-align:center.

the inner wrapper is inline-block, and responds to the text-align:center from the outer wrapper. It uses text-align:left to
overwrite the text center from the first wrapper.

The logo and menu are floated so they will be next to each other.

This is a good technique for centering when the widths can be variable.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: