CSS将选择文本的一部分向右对齐 [英] CSS align part of select text to the right
本文介绍了CSS将选择文本的一部分向右对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的HTML外观:
< select><选项>全名< span> P1</span></option><选项>彼得< span> P2</span</option><选项>雨果< span> K4</span>//option></select>
我想显示如下选择选项:
姓氏P1彼得P2雨果K4
代码(P1,P2,P4)与选择条件的右侧对齐-我不知道最长名称的长度,我宁愿不要为文本的任何部分设置确切的宽度
解决方案
http://jsfiddle.net/Tobsta/Lpb092gd/2/
CSS样式为< ul>
的函数,该函数将其选定的值发送到 display:none;
< select>
>
This is what my HTML looks like:
<select>
<option>Long name <span>P1</span></option>
<option>Peter <span>P2</span></option>
<option>Hugo <span>K4</span></option>
</select>
I would like to display select options like this:
Longname P1
Petr P2
Hugo K4
codes (P1, P2, P4) aligned to the right side of select, conditions - I don't know length of longest name and I would prefer not to set exact width to any part of text
解决方案
http://jsfiddle.net/Tobsta/Lpb092gd/2/
CSS styled <ul>
with a function that sends its selected value to a display: none;
<select>
这篇关于CSS将选择文本的一部分向右对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文