0

Hi I need to style some HTML elements in a separate CSS sheet. Below are the four options that need to be styled- how do I call them on my external style sheet?

<label>Select list</label>
            <select id = "myList">
               <option value = "1">Drama</option>
               <option value = "2">Thriller</option>
               <option value = "3">Comedy</option>
           <option value ="4">Horror</option>
             </select>
  • what you mean with "call" ? All you need is to load the CSS file in the HTML and have those elements/classes/ids styled in the .css file – Calvin Nunes Feb 17 '20 at 17:01
  • Take a look at this [list of CSS selectors](https://www.w3schools.com/cssref/css_selectors.asp.) – Jesse Feb 17 '20 at 17:02
  • Does this answer your question? [CSS to select another Element based on a HTML Select Option Value](https://stackoverflow.com/questions/16452634/css-to-select-another-element-based-on-a-html-select-option-value) – johannchopin Feb 17 '20 at 17:02
  • @Patricia Use this – Bhavanaditya Feb 17 '20 at 17:02
  • 1
    @Deykun What are you talking about? Spaces between the attribute name, the equals, and the quotes surrounding the attribute value are ignored by HTML parsers. – Heretic Monkey Feb 17 '20 at 17:07

1 Answers1

0

You can create external CSS file (mystyle.css) and add it in head section of your web page. In this you mystyle.css you can write css properties of HTML elements.

Below is the link you need to add in head file (update path of css file in href) :

<link rel="stylesheet" type="text/css" href="mystyle.css">
Himanshu Joshi
  • 292
  • 2
  • 10