![](/img/trans.png)
[英]With media query how do I make a form that uses grid layout to layout labels and form elements when the screen is greater than or equal to 600px wide?
[英]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.