CSS Selectors and Properties
What Are CSS Selectors?
p { color: blue; font-size: 16px; }.highlight { background-color: yellow; font-weight: bold; }<p class="highlight">This text will be highlighted.</p> <div class="highlight">This div will also be highlighted.</div>#header { background-color: #333; color: white; padding: 20px; }<div id="header">This is the header</div>* { margin: 0; padding: 0; }input[type="text"] { border: 1px solid #ccc; }<input type="text" /> <input type="password" />div p { color: red; }<div> <p>This paragraph will be red.</p> </div>div > p { color: green; }<div> <p>This paragraph will be green.</p> <span><p>This paragraph will not be green.</p></span> </div>a:hover { color: red; }<a href="#">Hover over me</a>p::first-letter { font-size: 2em; color: green; }<p>This is a paragraph with the first letter styled.</p>
What Are CSS Properties?
Last updated
Was this helpful?

