Font Size
The font-size
property sets the size of the text.
Being able to manage the text size is important in web design. However, you should not use font size adjustments to make paragraphs look like headings, or headings look like paragraphs.
Always use the proper HTML tags, like <h1> - <h6> for headings and <p> for paragraphs.
The font-size value can be an absolute, or relative size.
Absolute size:
- Sets the text to a specified size
- Does not allow a user to change the text size in all browsers (bad for accessibility reasons)
- Absolute size is useful when the physical size of the output is known
Relative size:
- Sets the size relative to surrounding elements
- Allows a user to change the text size in browsers
font-size
property sets the size of the text.Set Font Size With Pixels Explain
Setting the text size with pixels gives you full control over the text size.
Html Code:
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
font-size:250%;
}
h2 {
font-size:200%;
}
p {
font-size:100%;
}
</style>
</head>
<body>
<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<p>This is a paragraph.</p>
</body>
</html>
Post a Comment