Styles in the HTML (Inline CSS)

There are two ways to have CSS in your HTML code; one is through the style attribute, and the other is through the style tag.

The Style Attribute

We've seen this in the Introduction to CSS. Let's show another example.

If I have this HTML:

<input type="text"/>

and I want to set the font size in the input box, I can do this:

<input type="text" style="font-size: 2em"/>

The result is:

Web page with text that is styled larger

Next: The Style Tag

Comments

Leave a comment

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