html select下拉框样式怎么制作?html select样式详解


当前第2页 返回上一页

3.在select父元素后面用:after做一个新的样式。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

<body>

        <br />

        <select id="selectTravelCity" title="Select Travel Destination">

            <option>php中文网</option>

            <option>Washington DC</option>

            <option>Los Angeles</option>

            <option>Chicago</option>

            <option>Houston</option>

            <option>Philadelphia</option>

            <option>Phoenix</option>

        </select>

        <br />

        <br />

        <label id="lblSelect">

            <select id="selectPointOfInterest" title="Select points of interest nearby">

                <option>PHP中文网</option>

                <option>food beverage</option>

                <option>restaurant</option>

                <option>shopping</option>

                <option>taxi limo</option>

                <option>theatre</option>

                <option>museum</option>

                <option>computers</option>

            </select>

        </label>

</body>

这么多,虽然不是很难,但是还是要多练习的

看了上面的图片,这个的效果图也很容易能想到吧,不过我还是会给效果图的:

tuer.png

HTML select标签的两个案例分析:

案例一:如何让html里的select无法选择?

假设有一个select,里面有几个option,因为测试需要,要固定成为其中的一个option,不能选择其他,该怎么做呢?如果disabled这个select,结果就是根本没法取到值了。有没其他的方法?readonly,也是不可以的,依旧可以选择。

答案:只放一个option就可以了 或者给option加上disabled="disabled"

1

2

3

4

5

6

7

<form id="form1" name="form1" method="post" action="">

  <select name="select">

    <option>aa</option>

<option disabled="disabled">bb</option>

<option>cc</option>

  </select>

</form>

案例二:怎么调整select的宽度?

答案:可以在select标签中加入style样式

1

2

3

4

5

<style>.s1{ width: 200px;}</style>

<select class="s1">

  <OPTION>很长很长也能显示</OPTION>

  <OPTION>很长很长也能显示</OPTION>

</select>

以上就是这篇文章的全部内容了,有什么疑问欢迎在下方提问。

【小编推荐】

html5 canvas标签是什么意思?canvas标签使用方法介绍

HTML中插入文本ins标签和删除文本del标签如何一起使用?(附实例)

以上就是html select下拉框样式怎么制作?html select样式详解的详细内容,更多文章请关注木庄网络博客

返回前面的内容

相关阅读 >>

html中图片怎么居中对齐?

html元素语法介绍

html图片不显示怎么办

html空格代码怎么写?

html hr标签的属性有哪些?html hr标签的样式详解

html style标签怎么用

怎么修改html文件

html标签中行内元素和块级元素详解

javascript今年25 岁了!

html怎么去掉li的点

更多相关阅读请进入《select》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...