使用 CSS 设置选择选项的样式

cssweb developmentfront end technology更新于 2024/7/11 1:48:17

要设置 <select> 中选项的样式,您可以尝试运行以下代码

示例

<!DOCTYPE html>
<html>
   <head>
      <style>
         select {
            width: 100%;
            padding: 10px 15px;
            border: 1px dashed blue;
            border-radius: 4px;
            background-color: orange;
         }
      </style>
   </head>
   <body>
      <p>Learn,</p>
      <form>
         <select id = "country" name = "country">
            <option value = "java">Java</option>
            <option value = "ruby">Ruby</option>
            <option value = "oracle">Oracle</option>
            <option value = "tableau">Tableau</option>
         </select>
      </form>
   </body>
</html>

相关文章


有用资源