需要div对齐方面的帮助 [英] Need help with div alignment
问题描述
我希望能够让我的网站居中但不占用它周围的空间,我想要做的是让我的网站居中但是在主站点之外有一个侧箱占用空间在左边距,边距:auto;或保证金:0自动;在CSS不起作用,因为那时div占据了边缘的空间,没有任何其他的空间,并且没有浮动:中心;任何和所有帮助表示赞赏。
-Jordan
网站现在的截图:< a href =https://skydrive.live.com/redir?resid=BA174670C15415EE!111&authkey=!AAjj6qxMvhQz_IY> https://skydrive.live.com/redir?resid=BA174670C15415EE!111&authkey=!AAjj6qxMvhQz_IY [ ^ ]
I would like to be able to have my website centered but not take up the space around it, what I am trying to do is have my website centered but then have a side box outside of the main site that takes up the space in the left margin, the margin:auto; or margin: 0 auto; in css doesn''t work because then the div takes up the space in the margins and there is no room for anything else, and there is no float:center; Any and all help is appreciated.
-Jordan
Screenshot of how the site is now: https://skydrive.live.com/redir?resid=BA174670C15415EE!111&authkey=!AAjj6qxMvhQz_IY[^]
推荐答案
你需要在风格中同时使用auto:
You need to use both auto in the style:
margin-left:auto;
margin-right:auto;
这有点违反直觉,但工作正常。
这篇关于需要div对齐方面的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!