You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/css/introduction/how-to-add-css-to-html.md
+6-1Lines changed: 6 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,11 +32,13 @@ keywords:
32
32
css tutorial for beginners 2025,
33
33
css tutorial for learning,
34
34
]
35
+
hide_table_of_contents: true
35
36
---
36
37
37
38
In this tutorial, you will learn how to add CSS to an HTML document using internal, external, and inline styles. CSS (Cascading Style Sheets) is a style sheet language that is used to describe the look and formatting of a document written in HTML or XML. It allows you to style web pages and user interfaces, making it easier to create visually appealing and responsive websites.
38
39
39
40
<AdsComponent />
41
+
<br />
40
42
41
43
## How to Add CSS to HTML
42
44
@@ -81,6 +83,7 @@ When you run this HTML document in a web browser. It will display the content wi
81
83
</BrowserWindow>
82
84
83
85
<AdsComponent />
86
+
<br />
84
87
85
88
### 2. External CSS
86
89
@@ -116,6 +119,7 @@ h1 {
116
119
In this example, the CSS styles are defined in a separate file named `styles.css`, which is linked to the HTML document using the `<link>` element. The styles defined in the external CSS file are applied to the elements in the HTML document.
117
120
118
121
<AdsComponent />
122
+
<br />
119
123
120
124
When you run this HTML document in a web browser. It will display the content with the styles defined in the external CSS.
121
125
@@ -157,6 +161,7 @@ When you run this HTML document in a web browser. It will display the content wi
157
161
By using internal, external, and inline CSS, you can style web pages and user interfaces to create visually appealing and responsive websites.
158
162
159
163
<AdsComponent />
164
+
<br />
160
165
161
166
:::note
162
167
1. Make sure the `styles.css` file is in the same directory as the `index.html` file.
@@ -177,4 +182,4 @@ By using internal, external, and inline CSS, you can style web pages and user in
177
182
178
183
## Conclusion
179
184
180
-
In this tutorial, you learned how to add CSS to an HTML document using internal, external, and inline styles. Internal CSS is added within the `<style>` element in the `<head>` section, external CSS is added in a separate CSS file and linked to the HTML document using the `<link>` element, and inline CSS is added directly to an HTML element using the `style` attribute. By using these methods, you can style web pages and user interfaces to create visually appealing and responsive websites.
185
+
In this tutorial, you learned how to add CSS to an HTML document using internal, external, and inline styles. Internal CSS is added within the `<style>` element in the `<head>` section, external CSS is added in a separate CSS file and linked to the HTML document using the `<link>` element, and inline CSS is added directly to an HTML element using the `style` attribute. By using these methods, you can style web pages and user interfaces to create visually appealing and responsive websites.
0 commit comments