CSS is used to style text, such as changing colors, font sizes, and alignment. Example:
This text is styled with inline CSS.
CSS can add backgrounds to elements, like colors or images:
This paragraph has a highlighted background using a class.
CSS can style links and add hover effects:
This is a styled linkCSS helps in creating layouts, such as setting dimensions and alignment:
CSS can be added in three ways:
style attribute of an element.<style> tag in the HTML.Create a file named styles.css and add the following:
/* styles.css */
body {
background-color: #f0f0f0;
color: #333;
}
h1 {
color: #4CAF50;
}
Link it to your HTML file using:
<link rel="stylesheet" href="styles.css">