html - margin : 0 auto; not working

标签 html css

这是 fiddle :http://jsfiddle.net/Tb3sF/ .

I looked at this post .

我试过下面的代码(使用和不使用:display:block 和不同的宽度。)

.form {
   display: block;
   margin: 0 auto;
   width: 700px; 
}

谢谢!

最佳答案

It is centering使用 margin:0px auto,但是,由于它是 700px,您看不到它在这么小的窗口中居中。

尝试将其降低到 300 像素; see jsFiddle here

或者,您可以只使用 text-align:center; jsFiddle here

关于html - margin : 0 auto; not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19285930/

相关文章:

jquery - 使用 css 将图像缩放/过渡到父级的大小

html - 为什么元素没有在复选框中居中?

javascript - HTML5 Canvas - 暂停时耗时

html - Bootstrap-元素在超小尺寸上重叠

javascript - 如何在 react 中设置侧边栏和内容高度?

html - 如何覆盖某些 CSS 类设置

PHP 粘性表单下拉列表和复选框

javascript - 元素宽度沿一个方向减小

html - Firefox 上的错误 : checkbox hidding when i'm scrolling

html - css使动态<a>链接隐藏在html中