在< select&gt ;?中创建缩进的最佳现代方式 [英] Best modern way of creating indentation in a <select>?

查看:320
本文介绍了在< select&gt ;?中创建缩进的最佳现代方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您只定位到Firefox,Opera和Chrome,而不是IE,而且您只定位现代浏览器(在过去一年中发布),那么创建多级选项缩进的最佳方法是什么一个选择不使用optgroups?也就是说,当您希望父选项仍然可以选择时,以及子项?

If you're only targeting Firefox, Opera, and Chrome, not IE, and you're only targeting modern browsers (released in the ~past year), what is the best way of creating multi-level indentation of options in a select without using optgroups? That is, when you want the parent options to still be selectable, as well as the children?

<select>
    <option>
    <option>
        <option>
        <option>
        <option>
    <option>
        <option>
        <option>
            <option>
            <option>
            <option>
        <option>
        <option>
    <option>
    <option>
</select>

这是最好的,虽然我不知道它是否真的可能, /子关系,但如果不是,至少是一种使它看起来像,在三个浏览器之间的用户体验类似的方式?

It would be preferable, though I don't know if it's actually possible yet, to have actual parent/child relationships between levels of options, but if it's not, at least a way of making it look like there is, where the user-experience is similar between the three browsers?

推荐答案

< option> 前加上适当数量的& nbsp; (分别为字符代码160)。

Prefix your <option> text with an appropriate amount of &nbsp; (character code 160, respectively).

这篇关于在&lt; select&gt ;?中创建缩进的最佳现代方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆