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:

<style>
  #banana {
    background-color: yellow;
  }
</style>
<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

Comments

Leave a comment

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