How to Hide Option in Select Menu with CSS ? Last Updated : 09 Oct, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report In HTML, the <select> tag creates a dropdown menu for user selection. Hiding certain options with CSS allows them to remain in the code but be invisible to users. This technique is useful for conditional display or future reactivation without code changes.Syntaxselect option[value="value-to-hide"] { display: none; }ApproachTo hide a specific option in a select menu using CSS, you need to follow the following steps:Create a <select> Tag: Add a <select> element and multiple <option> elements in HTML.Assign Value Attributes: Set a unique value attribute for each <option>, like value="apple".Apply CSS to Hide Options: Use display: none; in CSS to hide specific options.Update and Test: Save changes, refresh the page, and verify the hidden option is not visible.Example: In this example we hides an option in a dropdown menu using CSS. The select option[value="option3"] { display: none; } rule makes "Option 3" invisible while keeping it in the HTML code. HTML <!DOCTYPE html> <html> <head> <title> Hide Option in Select Menu using CSS </title> <style> /* This CSS rule hides the option with a value of "option3" */ select option[value="option3"] { display: none; } </style> </head> <body> <h1 style="color:green;"> GeeksforGeeks </h1> <select> <option value="option1">Option 1</option> <option value="option2">Option 2</option> <!-- This option will be hidden --> <option value="option3">Option 3</option> <option value="option4">Option 4</option> </select> </body> </html> Output: Example 2: In this example we use CSS to hide odd-numbered options in a dropdown menu. The rule select option:nth-child(odd) { display: none; } hides "Option 1" and "Option 3" while keeping them in the code. HTML <!DOCTYPE html> <html> <head> <title> Hide Option in Select Menu using CSS </title> <style> select option:nth-child(odd) { display: none; } </style> </head> <body> <!-- Create a heading with green color --> <h1 style="color:green;"> GeeksforGeeks </h1> <!-- Create another heading --> <h1>Example 2</h1> <!-- Create a select menu with four options --> <select> <option value="option1">Option 1</option> <option value="option2">Option 2</option> <option value="option3">Option 3</option> <option value="option4">Option 4</option> </select> </body> </html> Output: Comment More infoAdvertise with us Next Article Primer CSS Select menu List Items B bardock2393 Follow Improve Article Tags : Web Technologies CSS CSS-Questions Similar Reads How to Change Options of <select> with jQuery ? In this article, we will see how we can change options of <select> with the help of jQuery. Here we have options in the select tag and we want to change it dynamically when the user clicks a button. PrerequisitesHTMLCSSJavaScriptjQuerySyntax$("#op4").empty().append(text)ApproachCreate a card s 2 min read Primer CSS Select Menu Header Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by 2 min read How to create a Disabled Option Select using jQuery Mobile ? jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will be creating a Disabled Option Select using jQuery Mobile. Approach: First, add jQuery Mobile scripts needed for your project. <link rel= 1 min read Primer CSS Select menu List Items Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by 2 min read Primer CSS Select menu Divider Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by 2 min read How to use Checkbox inside Select Option using JavaScript ? In this article, we are going to learn how to use Checkbox inside Select Option using JavaScript. ApproachThe HTML contains a styled dropdown (selectBox) and hidden checkboxes (checkBoxes).CSS styles enhance the appearance, styling the dropdown and checkboxes.The function showCheckboxes() toggles ch 2 min read Like