使用普通的旧CSS,为什么"max-width"不能用于以下方面:
button {
text-align: center;
max-width: 540px;
height: auto;
display: block;
padding: 10px 0;
margin: 0 auto;
border: none;
}
Run Code Online (Sandbox Code Playgroud)
这个元素的包装:
#wrapper {
max-width: 1024px;
overflow: hidden;
position: relative;
margin: 0 auto;
padding: 0 50px;
text-align: center;
}
Run Code Online (Sandbox Code Playgroud)
编辑
代码添加到jsfiddle:http://jsfiddle.net/BXdrG/
egr*_*103 22
好吧,我误解了它的用法.为了得到一个不会伸展到大尺寸的流畅按钮,我添加了以下内容:
width:100%;
max-width: 540px;
Run Code Online (Sandbox Code Playgroud)
谢谢评论者!
button {
text-align: center;
max-width: 540px;
height: auto;
display: block;
padding: 10px 0;
margin: 0 auto;
border: none;
width:100%; /* you forgot this */
}
Run Code Online (Sandbox Code Playgroud)