![](/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.