HTML Heading 3 Element
HTML Heading 3 <h3>
tag is used to define heading of type 3 in an HTML document.
Example
A simple Heading 3 element is shown in the following example.
index.html
</>
Copy
<!DOCTYPE html>
<html>
<body>
<h3>Hello World</h3>
</body>
</html>
Note: HTML Heading 3 element starts with the tag <h3>
and ends with an end tag </h3>
.
Default CSS for HTML <h3>
By default, following CSS properties are set for a Heading 3 element.
</>
Copy
display: block;
font-size: 1.17em;
margin-block-start: 1em;
margin-block-end: 1em;
margin-inline-start: 0px;
margin-inline-end: 0px;
font-weight: bold;
Inline Style for HTML Heading 3 Element
We can change the style of Heading 3 element through inline styling using style attribute.
In the following example, we have set the color as red for the Heading 3 element.
index.html
</>
Copy
<!DOCTYPE html>
<html>
<body>
<h3 style="color:red;">Hello World</h3>
</body>
</html>
Apply CSS for HTML Heading 3 Element
We can apply CSS for all Heading 3 elements using the h3
tag.
index.html
</>
Copy
<!DOCTYPE html>
<html>
<head>
<style>
h3 {
color:red;
}
</style>
</head>
<body>
<h3>Hello World</h3>
</body>
</html>
Conclusion
In this HTML Tutorial, we learned about HTML <h3> tag and went through different examples that cover defining an HTML Heading 3 element, and styling it.