簡體   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