0
我想編寫輸入表單與指示貫穿始終。我希望文本不能被選擇,但是當然我希望輸入是可選的,以便用戶可以輕鬆修改文本。CSS:無法選擇用戶選擇文本的孩子選擇:自動,而父母有用戶選擇:無
我的HTML看起來是這樣的:
<div id="form">
<header> Some header text </header>
Instructions on what to do.
<form>
<label>first name:</label><input type="text" name="fname" />
<label>last:</label><input type="text" name="lname" />
<label>email:</label><input type="text" name="email" />
</form>
<div id="extras"> A bunch of separate notes and maybe a textarea box</div>
</div>
和我的CSS看起來是這樣的:
#form{ user-select:none; }
#form form input{user-select:auto}
有兩點要注意:
我包括了所有在各種瀏覽器的CSS我實際的代碼。
我試過用戶選擇:文本,並沒有工作。
我有很多文本分成不同的部分,所以我非常希望刪除選擇默認行爲的能力,並將選擇的能力應用於輸入。應用代碼來使每一點文本不可選擇將是一種痛苦。
即使我做了上述修復,我仍然會對這個問題感到好奇。
任何人都知道爲什麼會發生這種情況?