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
When you start working with HTML and CSS, you'll notice that some styles are applied to your web pages even before you write any CSS. These styles are called "default browser styles" or "user-agent styles".
11
11
@@ -23,6 +23,8 @@ These heading tags help define the hierarchy and structure of your content.
23
23
24
24
The following example shows all six heading elements from `h1` to `h6`.
25
25
26
+
:::interactive_editor
27
+
26
28
```html
27
29
<h1>Heading 1</h1>
28
30
<h2>Heading 2</h2>
@@ -32,10 +34,14 @@ The following example shows all six heading elements from `h1` to `h6`.
32
34
<h6>Heading 6</h6>
33
35
```
34
36
37
+
:::
38
+
35
39
Another element with default styles is the `hr` element, which creates a horizontal rule often used to visually separate sections of content. Browsers generally apply a simple line style to this element.
36
40
37
41
To understand it better, let's look at this code example:
38
42
43
+
:::interactive_editor
44
+
39
45
```html
40
46
<p>Paragraph 1</p>
41
47
<p>Paragraph 2</p>
@@ -44,6 +50,8 @@ To understand it better, let's look at this code example:
44
50
<p>Paragraph 4</p>
45
51
```
46
52
53
+
:::
54
+
47
55
The horizontal rule appears as a thin line with spacing above and below the text to distinguish between sections of content.
48
56
49
57
Next, we will look at the `blockquote` element.
@@ -54,6 +62,8 @@ The indentation helps set blockquotes apart from the rest of the text, making it
54
62
55
63
Let's take a look at this code example:
56
64
65
+
:::interactive_editor
66
+
57
67
```html
58
68
<p>Paragraph 1</p>
59
69
<p>Paragraph 2</p>
@@ -62,12 +72,16 @@ Let's take a look at this code example:
62
72
<p>Paragraph 4</p>
63
73
```
64
74
75
+
:::
76
+
65
77
In the example above, the `blockquote` element will produce an indent on the text, applied by the default browser styles.
66
78
67
79
Another element with default styles is the anchor element (`<a>`), which is styled with a default blue color and underlining to make it recognizable as a link.
68
80
69
81
Let's take at look at the following HTML example:
70
82
83
+
:::interactive_editor
84
+
71
85
```html
72
86
<p>Paragraph 1</p>
73
87
<p>Paragraph 2</p>
@@ -76,6 +90,8 @@ Let's take at look at the following HTML example:
76
90
<p>Paragraph 4</p>
77
91
```
78
92
93
+
:::
94
+
79
95
The above code has four paragraph elements with an anchor element in the middle. The anchor element is styled in blue with an underline to show users to go to the freeCodeCamp learn page.
80
96
81
97
Finally, we'll look at the unordered and ordered list elements.
@@ -84,6 +100,8 @@ Browsers add basic formatting to lists, including indentation and bullets or num
84
100
85
101
Let's take a look at an example:
86
102
103
+
:::interactive_editor
104
+
87
105
```html
88
106
<p>Sample Paragraph</p>
89
107
<ol>
@@ -99,6 +117,8 @@ Let's take a look at an example:
99
117
<p>Ending Paragraph</p>
100
118
```
101
119
120
+
:::
121
+
102
122
In the above code example, we are using an unordered list and an ordered list. Both of these lists will be slightly indented to the right by default.
103
123
104
124
For all of these examples, you saw how the browser applied default spacing, varying font sizes, and weights to these HTML elements.
0 commit comments