Using Styling Keywords in HTML
Using Styling Keywords in HTML
HTML offers several keywords and attributes that allow you to add styling to your web pages. One of the most common ways to style HTML elements is by using CSS (Cascading Style Sheets).
Linking CSS with HTML
To apply CSS styles to your HTML document, you can use the <link>
element. This element is placed within the <head>
section of your HTML document.
The <link>
element requires the rel
attribute, which should be set to stylesheet
. Additionally, you need to specify the href
attribute to point to the location of your CSS file.
For example:
<link rel="stylesheet" href="styles.css">
Internal CSS
You can also add CSS styles directly within your HTML document using the <style>
element. This element is placed within the <head>
section of your HTML document.
For example:
<style>
h1 {
color: blue;
}
</style>
Inline CSS
If you only need to apply a style to a single element, you can use the style
attribute directly within the HTML tag.
For example:
<p style="font-size: 20px; color: red;">This is a styled paragraph.</p>