[HTML5] style tag --Write a style sheet (CSS)

You can use style tags to write style sheets (CSS) in HTML.

<style>
  h5 {
    color: red;
  }
</style>
h5 tag-Heading 5

Can I write a style using the style tag in HTML?

You want to ask, "Can I write a style using the style tag in HTML?"

In principle, it is better to read a style sheet (CSS) file

As a general rule, it is best practice to read a stylesheet (CSS) file. The basic stylesheet settings for your website should be in a Stahlsheet (CSS) file like "/css/default.css" and put it in the HTML header. to load.

<link rel = "stylesheet" type = "text / css" href = "/ css / default.css">

When writing a style for trial

When trying out and writing styles, I often use the sytle tag. The stylesheet (CSS) file is in a different directory, so it's a hassle to open.

If you just want to give it a try, what happens if this happens, you often use the style tag.

If you want to change the style programmatically

While doing web system development, sometimes if statement.

In such a case, you can use the style tag to set the condition only if the condition is satisfied.

However, this is only rare, so in principle, write everything in a stylesheet (CSS) file.

Associated Information