The Style Tag

The <style> tag can be used to put CSS directly into your HTML page. Let's see an example.

If I have this HTML:

<div id="banana">Banana</div>

I can insert a <style> tag:

  #banana {
    background-color: yellow;
<div id="banana">Banana</div>

The #banana text above is called a selector. It tells the CSS to style an element that has an ID of banana.

Next: How to Use a CSS File Instead of CSS in the HTML


Leave a comment

What color are brown eyes? (spam prevention)
Code under MIT License unless otherwise indicated.
© 2020, Downranked, LLC.