margin-left:auto和margin-right:auto不处理输入 [英] margin-left: auto and margin-right: auto not working on input

查看:134
本文介绍了margin-left:auto和margin-right:auto不处理输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我正在尝试在中心对齐的表单。通常 margin-left:auto 和 margin-right:auto 时无法响应display:块不会添加到CSS。我已经添加了 display:block 到我的CSS,但它仍然没有显示,因为我希望它。

I have an input in a form that I am trying to align in the center. Usually margin-left:auto and margin-right: auto fail to respond when display: block isn't added to the CSS. I have added display: block to my CSS but still it isn't display as I would like it to.

我做了一个JSFiddle以便更容易理解: http://jsfiddle.net/XnKDQ/97/

I've made a JSFiddle to keep easier to understand: http://jsfiddle.net/XnKDQ/97/

推荐答案

为了使 margin:0 auto; 除了 display:block a width 之外,还需要指定。

In order for margin: 0 auto; to work, in addition to display:block a width needs to be specified.

这篇关于margin-left:auto和margin-right:auto不处理输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆