如何将与页面的中间(水平/宽度)对齐(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 answersI 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>更多推荐
发布评论