HTML CSS
HTML CSS Tutorial
In this tutorial, we will learn how HTML CSS works together to create stylish and visually appealing web pages. CSS stands for Cascading Style Sheets, and it is used to control the layout and design of a web page.
Step 1: Connecting CSS to HTML
To connect CSS to HTML, we use the <link> tag in the <head> section of the HTML document. The <link> tag has three important attributes: rel, type, and href.
<link rel="stylesheet" type="text/css" href="styles.css">
Step 2: Applying CSS to HTML Elements
To apply CSS styles to HTML elements, we use selectors and declarations. Selectors target specific HTML elements, and declarations define the style properties.
For example, to change the color of all <h1> elements to blue, we would use the following CSS code:
h1 {
color: blue;
}
Step 3: Adding Styling to Text
We can add styling to text using CSS properties such as font-size, font-family, and text-align. For example, to change the font size of all paragraphs to 16px, we would use the following CSS code:
p {
font-size: 16px;
}
Fictional Data Example
| Name | Age | Location |
|---|---|---|
| John Doe | 25 | New York |
| Jane Smith | 30 | Los Angeles |
In this example, we have a fictional table showing the names, ages, and locations of two individuals. We can style this table using CSS to make it more visually appealing.
By following these steps and practicing with different CSS properties, you can create beautiful and responsive web pages using HTML CSS.