html - 如何正确居中对齐 Div?

标签 html css

我无法正确居中 my website

当我缩小时它似乎居中。但对于不缩小的用户来说,它看起来不合适。有什么建议么?该站点是使用所有 AP div 创建的,即使尝试使用以下内容也无法正确居中:

<div align="center">

最佳答案

为容器 div 尝试 margin:0 auto; 它会居中对齐你的 div :)

See the example

See the fullscreen view of the result

关于html - 如何正确居中对齐 Div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13131996/

相关文章:

javascript - 如何更改 Bootstrap 中的默认 Div 位置

html - 选中复选框时,asp .net 页面更改标签的背景颜色

html - 保持元素固定,紧挨着变换元素

css - 使子div float 在父级的右边

html - 强制一个 div 变得比浏览器窗口更宽

HTML CSS : Hover Property not Working on Google Icon

javascript - 顺利打开div

html - 如何让 div 适合屏幕而不会在 CSS 中溢出

javascript - 在 RMarkdown 演示文稿中滚动幻灯片(revealjs)

javascript - 如何让我的背景图像随光标移动?试图实现这个codepen