html - 为什么跨度位于选择可点击的后面?

标签 html css

为什么 span 元素是可点击的,即使它位于 select 元素的“后面”。

jsfiddle

span {
    color: red;
    display: block;
}
select {
    font-weight: bold;
    font-size: 15px;
    display: block;
    margin-top: -20px;
}
<span>test test test</span>
<select>
    <option></option>
    <option>hello world</option>
</select>

最佳答案

因为第一个选项为空

澄清一下前面的内容

span {
    color: red;
    display: block;
    background-color: blue;
    cursor: help;
}
select {
    font-weight: bold;
    font-size: 15px;
    display: block;
    margin-top: -20px;
}
<span>test test test</span>
<select>
    <option></option>
    <option>hello world</option>
</select>

但是选择 hello world 就可以了

也很有趣:(看光标在哪里变化)

span {
    color: red;
    display: block;
    background-color: blue;
    cursor: help;
}
select {
    font-weight: bold;
    font-size: 15px;
    display: block;
    margin-top: -20px;
}
<span>test test test</span>
<select>
    <option>........</option>
    <option>hello world</option>
</select>

关于html - 为什么跨度位于选择可点击的后面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30878286/

相关文章:

javascript - 图像轮播中的双 "active"类

jquery - 如何使用jquery更改div内多个iframe的高度

html - 如何验证 HTML5(例如未闭合的 <p> 标签)

html - 如何突出显示 XSLT 中的特定行

javascript - 在 2 个 CSS 工作表之间切换

javascript - 修改光标 'lags'

javascript - jquery - 鼠标松开后查找 2 个不同的元素

html - Flexbox 3 div,两列,一列两行

html - 自定义 Bootstrap 3 轮播

jquery - malihu-custom-scrollbar-plugin 具有开箱即用的 vue 动态内容