HTML Styles Tutorial
Welcome to our HTML Styles tutorial! In this tutorial, we will learn about different ways to style your HTML content using CSS. Let's get started!
See our CSS complete tutorial here
Inline Styles
You can add styles directly to an HTML element using the style
attribute. Here's an example:
<p style="color: red; font-size: 18px;">This is a red paragraph with font size 18px</p>
Internal Styles
You can also add styles within the <head>
section of your HTML document using the <style>
tag. Here's an example:
<style>
p {
color: blue;
font-size: 16px;
}
</style>
External Styles
Another way to add styles to your HTML content is by linking an external CSS file. Here's an example:
<link rel="stylesheet" href="styles.css">
Combining Styles
You can also combine different types of styles. For example, you can use inline styles along with internal or external styles. Here's an example:
<div style="background-color: lightgray;">
<p>This is a paragraph with a light gray background color.</p>
</div>