html - Chrome 不响应 CSS

标签 html css google-chrome

我很难让所选字段在最新版本的 Chrome 中正常工作。 这一切在 Firefox 中都运行得很好,但 Chrome 却很顽固。 在 Chrome 中应该是这样的:

enter image description here

Chrome 中的实际情况是这样的:

enter image description here

HTML:

<td><!--<input type='text' name='ruum' />-->
<select>
    <option type="text" value="ruum">Uks</option>
    <option type="text" value="ruum">Kaks</option>
    <option type="text" value="ruum">Kolm</option>
</select>
</td>

CSS:

option{ /*works for firefox but not for chrome*/
width:8.5em;
float:left;
}

@media screen and (-webkit-min-device-pixel-ratio:0) { /*doesn't do anything*/
 option{
    width:8.5em;
    float:left;
 } 
}

有什么想法吗?谢谢。

最佳答案

选择上设置宽度,而不是在选项上设置:

select {
    width: 8.5em;
    float: left;
}

此外,option 没有 type 属性。请参阅:http://www.w3.org/TR/html5/forms.html#the-option-element

关于html - Chrome 不响应 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15219619/

相关文章:

javascript - 如何设置回调 onDisable chrome 扩展

javascript - 如何创建我们在 google 页面上看到的要求您将 Google 设置为主页的气泡?

javascript - 仅使用 JavaScript 捕获 ESC 键

javascript - jQuery:根据if语句添加css

javascript - 为什么我的决策树不起作用?

css - 为什么我的页面在 Firefox 和 IE 11 中看起来不对?

javascript - jQuery 功能臃肿且不必要?

html - 基本 CSS 不响应/移动设备友好

css - 媒体查询冲突

javascript - Chrome 扩展内容脚本访问扩展框架