选择尺寸属性大小在Chrome / Safari中无法使用? [英] Select size attribute size not working in Chrome/Safari?

查看:170
本文介绍了选择尺寸属性大小在Chrome / Safari中无法使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何解决选择属性大小的问题,如代码中所示:

How to solve problem that select attribute size, like in code:

<select size="2">
    <option value="0" selected="selected">Default</option>
    <option value="1">select 1</option>
    <option value="2">select 2</option>
    <option value="3">select 3</option>
</select>

如何在Chrome和Safari中使用它?

How can I get it working in Chrome and Safari?

推荐答案

这是 已知错误webkit浏览器

This is a known bug in webkit browsers.

在Chrome和Safari中使用它最简单的工作方式是手动指定选择本身的样式。

The simplest way to get it to work just how you like it in Chrome and Safari would be to manually specify the styling the select itself.

以下是 working jsFiddle

HTML

<select size="2">
   <option value="0" selected="selected">Default</option>
   <option value="1">select 1</option>
   <option value="2">select 2</option>
   <option value="3">select 3</option>
</select>

CSS:

select {
    height:36px;
    font-size:14px;
}

这篇关于选择尺寸属性大小在Chrome / Safari中无法使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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