如何将与页面的中间(水平/宽度)对齐(How to align a to the middle (horizontally/width) of the page [duplicate])

编程入门 行业动态 更新时间:2024-10-27 09:34:22
如何将与页面的中间(水平/宽度)对齐(How to align a to the middle (horizontally/width) of the page [duplicate])

我有一个宽度设置为800px的div标签。 当浏览器宽度大于800px时,它不应该拉伸div,而应该将其带到页面的中间。

This question already has an answer here:

How to horizontally center a <div>? 98 answers

I have a div tag with width set to 800 pixels. When the browser width is greater than 800 pixels, it shouldn't stretch the div, but it should bring it to the middle of the page.

最满意答案

<body> <div style="width:800px; margin:0 auto;"> centered content </div> </body> <body> <div style="width:800px; margin:0 auto;"> centered content </div> </body>

更多推荐

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

发布评论

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

>www.elefans.com

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