How to hide option in html

青灯夜游
Release: 2021-12-01 10:20:28
Original
4085 people have browsed it

Method: 1. Set the hidden attribute to the option tag with the syntax "

How to hide option in html

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

htmlHow to hide option

Method 1: Set the hidden attribute to the option tag

The browser should not display elements that have the hidden attribute specified.

<select>
  <option>默认---喜欢什么水果</option>
  <option hidden="hidden">苹果</option>
  <option>梨子</option>
  <option>桃子</option>
  <option>香蕉</option>
</select>
Copy after login

How to hide option in html

Method 2: Add the "display:none" style to the option tag

<select>
  <option>默认---喜欢什么水果</option>
  <option hidden="hidden">苹果</option>
  <option style="display: none;">梨子</option>
  <option>桃子</option>
  <option>香蕉</option>
</select>
Copy after login

How to hide option in html

Method 3: Add the "visibility:hidden" style to the option tag

<select>
  <option>默认---喜欢什么水果</option>
  <option hidden="hidden">苹果</option>
  <option style="display: none;">梨子</option>
  <option>桃子</option>
  <option style="visibility: hidden;">香蕉</option>
</select>
Copy after login

How to hide option in html

Recommended tutorial: "html video tutorial"

The above is the detailed content of How to hide option in html. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template