繁体   English   中英

当屏幕大于或等于 600px 宽(包括我的代码)时,如何使用媒体查询制作一个 600px 宽的表单?

[英]Using media queries how do I make a form that is 600px wide when the screen is greater than or equal to 600px wide (my code included)?

我在想以下...

@media only screen and (min-width: 600px) {
.form {
width: 600px}
}

我对么?

您真的不需要为此进行媒体查询。 如果您将宽度设置为 600px 和最大宽度以防止其超过 100%,它将起作用。

 form { width: 600px; max-width: 100%; margin: 0 auto; }
 <form> <fieldset> <legend>Example Form</legend> <div> <label>Name<br /><input type="text" name="name" /></label> </div> <div> <button>Submit</button> </div> </fieldset> </form>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM