CSS Tutorial
CSS (Cascading Style Sheets) allows you to style your web pages, controlling their appearance and layout. Here's how you can use CSS effectively:
style
attribute.<p style="color: red;">This text is red.</p>
<style>
element in the <head>
of your HTML document.<head>
<style>
body {
font-family: Arial, sans-serif;
}
</style>
</head>
<link>
element.<head>
<link rel="stylesheet" href="style.css">
</head>
Note: External stylesheets are preferred as they allow for easy maintenance and reuse of styles.
To apply a background color and font size to a paragraph, you can use the following CSS:
p {
background-color: #f0f8ff;
font-size: 1.2rem;
}
<h1>
, <h2>
) for structure and meaning.