自定义select下拉列表样式

 时间:2024-10-11 18:55:46

1、新建html文档。

自定义select下拉列表样式

2、书写hmtl代艨位雅剖码。<center><div class="example忧溲枷茫_1"> <p></p> <label for="demo-select_1">Example 1:</label> <select name="" id="demo-select_1"> <optgroup label="项目一"> <option>item 1</option> <option >Item 2</option> <option >Item 3</option> </optgroup> <optgroup label="项目二"> <option>Item</option> <option>Item</option> </optgroup> </select> <button id="button_1">Set disable</button></div></center>

自定义select下拉列表样式

3、书写css代码。.example_1 select, .example_2 select { widt茑霁酌绡h: 200px; }.example_1 label, .example_2 label { cursor: pointer; }.b-custom-select { position: relative; display: inline-block; height: 23px; background: #fff; border-width: 1px; border-style: solid; border-top-color: #c3c3c3; border-bottom-color: #838383; border-left-color: #a2a2a2; border-right-color: #a2a2a2; -webkit-box-shadow: inset 0 1px 3px 1px #f2f2f4; box-shadow: inset 0 1px 3px 1px #f2f2f4; font-size: 13px; vertical-align: middle; text-align: left; }.b-custom-select_disabled { color: #bcbcbc; background: #f9f9f9; }.b-custom-select_focus { }.b-custom-select_expanded { z-index: 199; height: 24px; border-bottom: none; border-radius: 3px 3px 0 0; }.lte7 .b-custom-select { display: inline; zoom: 1; }.b-custom-select__title { cursor: pointer; overflow: hidden; }.b-custom-select__title__text { margin: 5px 30px 3px 10px; font-size: 12px; white-space: nowrap; overflow: hidden; }.b-custom-select__title__icon { position: absolute; top: 0px; right: 0px; display: block; width: 22px; height: 23px; border-left: 1px solid #d8d8d8;border-radius: 0 3px 3px 0; background: #fff; }.b-custom-select__title__icon:after { content: ""; position: absolute; top: 10px; right: 7px; border-top: 5px solid #666; border-left: 5px solid transparent; border-right: 5px solid transparent; }.b-custom-select_disabled .b-custom-select__title__icon { background: #f9f9f9; }.b-custom-select__title__input { height: 20px; padding: 2px 9px; border: none; background: none; outline: 0;font-size: 12px; }.b-custom-select__dropdown { background: #fff; border: 1px solid #cccccc; border-width: 1px; border-style: solid; border-top-color: #c3c3c3; border-bottom-color: #838383; border-left-color: #a2a2a2; border-right-color: #a2a2a2; -moz-border-radius: 0 0 3px 3px; -webkit--moz-border-radius: 0 0 3px 3px; border-radius: 0 0 3px 3px; overflow: hidden; }.b-custom-select__list { padding: 5px 5px; }.b-custom-select__group { padding: 4px; white-space: nowrap; font-size: 12px; font-weight: bold; }

自定义select下拉列表样式

4、书写并添加js代码。<script src="jquery-1.8.3.min.js"></script><script src="js/jquery.custom-select.js"></script>

自定义select下拉列表样式

5、代码整体结构。

自定义select下拉列表样式

6、查看效果。

自定义select下拉列表样式
  • 如何使用notepad++制作一个HTML文件
  • 编写软件测试计划的步骤?
  • jquery如何获取div之间的内容
  • Protel 99全局修改PCB封装的方法
  • 缸豆的营养价值及功效
  • 热门搜索
    防灾减灾的手抄报 关于元旦的手抄报 绿色家园手抄报 科学手抄报内容 春节手抄报内容文字 弟子规手抄报 禁毒防艾手抄报 饮食安全手抄报 反邪教手抄报内容 关于数学的手抄报