簡體   English   中英

省略號無法正常用於標簽

[英]Ellipsis is not working properly for label

嗨,我想要我的標簽的省略號樣式,它在 UL 內。 我嘗試為 ul 和省略號添加最大寬度和最小寬度,並為標簽隱藏溢出。 那個時候標簽內容就放下了。 我在標簽中有一個輸入和文本。 給出了我試過的代碼

 ul{ min-width: 200px; margin: 0; border-radius: 0; max-height: 270px; max-width: 200px; background:red; } label{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display:block; }
 <html> <ul class="dropdown-menu main "> <li> <a href="#">Select All</a> </li> <li> <a href="#">Select None</a> </li> <li> <label>my numbers</label> </li> <div "> <li> <input type="checkbox"> <label class="">one</label> </li> <li> <input type="checkbox"> <label class="">oneeeeeeeeeeeeeeeeee</label> </li> <li> <input type="checkbox"> <label class="">twoooooooooooooooooooo</label> </li> </div> <button >cancel</button> <button >Apply</button> </ul> </html>

誰能幫幫我嗎。 謝謝......

將省略號規則移至li並將label s 設置為display:inline;

 ul { min-width: 200px; margin: 0; border-radius: 0; max-height: 270px; max-width: 200px; background: red; } label { display: inline; } li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
 <html> <ul class="dropdown-menu main "> <li> <a href="#">Select All</a> </li> <li> <a href="#">Select None</a> </li> <li> <label>my numbers</label> </li> <div> <li> <input type="checkbox"> <label class="">one</label> </li> <li> <input type="checkbox"> <label class="">oneeeeeeeeeeeeeeeeee</label> </li> <li> <input type="checkbox"> <label class="">twoooooooooooo0000oooooooo</label> </li> </div> <button>cancel</button> <button>Apply</button> </ul> </html>

還要注意<div ">會引起一些痛苦。IDE 會提示無效的語法,但如果您是色盲,則不會注意到這一點。 在此處輸入圖片說明

你在 html 中有錯誤,這項工作

 ul{ min-width: 200px; margin: 0; border-radius: 0; max-height: 270px; max-width: 200px; background:red; } label{ overflow: hidden; text-overflow:ellipsis; white-space: nowrap; display:block; }
 <html> <ul class="dropdown-menu main "> <li> <a href="#">Select All</a> </li> <li> <a href="#">Select None</a> </li> <li> <label>my numbers</label> </li> <div> <li> <input type="checkbox"> <label class="">onefdgdsfandsfñjndjñkadsnfkjsadoyhfgbohdsaingdsag</label> </li> <li> <input type="checkbox"> <label class="">oneeeeeeeeeeeeeeeeeefdsafndsaifndaipfjndsapfijondsaf</label> </li> <li> <input type="checkbox"> <label class="">twoooooooooooooooooooooooooooooooooooadsfndsapifdsaofndsam0finkdsaf</label> </li> </div> <button >cancel</button> <button >Apply</button> </ul> </html>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM