我的select标签与size属性的行为不正确,所以我需要其他解决方案 [英] My select tag is not behaving correctly with size attribute so I need other solution

查看:354
本文介绍了我的select标签与size属性的行为不正确,所以我需要其他解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有这个房屋销售网站(在说明中),如果你点击顶部的'Inchirieri Apartamente'按钮,一个窗口将出现。有一个select标签选择最低价格(它是从上到下的第3个选择标签)。



单击它时,它有显示级别为20个可见选项(在此之后你需要滚动查看其余部分)。



我想要的是将这个数字减少到5或6个可见选项。我已经尝试了'size'属性,但它会使我的选择标签高度变形并使其看起来很糟糕。



我想要这个:

https://i.stack.imgur.com/sMVa8.png [ ^ ]



不是这样的:

https://i.stack.imgur.com/1lE7L.png [ ^ ]



谢谢!



我尝试过:



使用size tag =>糟糕的结果



这是代码:

https://jsfiddle.net/0ya2vnLb/10/

Hello Everyone,

I have this house-selling website ( in the description ) where if you click the 'Inchirieri Apartamente' button on top, a window will appear. There is the select tag which selects the minimum price ( it is the 3th select tag from up to down ).

When you click it, it has the option display level to 20 visible options ( after this nr you need to scroll to see the rest ).

What I would want would be to decrease this number to maybe 5 or 6 visible options. I already tried 'size' attribute but it deforms my select tag height and makes it look awful.

I'd want this:
https://i.stack.imgur.com/sMVa8.png[^]

Not this:
https://i.stack.imgur.com/1lE7L.png[^]

Thanks!

What I have tried:

Using size tag => bad result

Here's the code:
https://jsfiddle.net/0ya2vnLb/10/

推荐答案

我认为这样做。



HTML选择+限制可见选项数 - Stack Overflow [ ^ ]



你为什么不是使用任何类型的js框架,甚至是jquery?
I think this will do it.

HTML Select + limit number of options visible - Stack Overflow[^]

Why aren't you using any sort of js framework, or even jquery?


这篇关于我的select标签与size属性的行为不正确,所以我需要其他解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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