需要div对齐方面的帮助

编程入门 行业动态 更新时间:2024-10-20 09:26:30
本文介绍了需要div对齐方面的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我希望能够让我的网站居中但不占用它周围的空间,我想要做的是让我的网站居中但是在主站点之外有一个侧箱占用空间在左边距,边距:auto;或保证金:0自动;在CSS不起作用,因为那时div占据了边缘的空间,没有任何其他的空间,并且没有浮动:中心;任何和所有帮助表示赞赏。 -Jordan 网站现在的截图: skydrive.live/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: skydrive.live/redir?resid=BA174670C15415EE!111&authkey=!AAjj6qxMvhQz_IY[^]

推荐答案

你需要在风格中同时使用auto: You need to use both auto in the style: margin-left:auto; margin-right:auto;

这有点违反直觉,但工作正常。

-SA

更多推荐

需要div对齐方面的帮助

本文发布于:2023-11-28 15:28:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1642958.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:div

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!