- Using HTML
<font>
Tag (Deprecated – Not Recommended) - Using Inline CSS
- Using Internal or External CSS
1. Changing Font Using
<font>
Tag (Deprecated)Earlier, HTML had a
<font>
tag that was used to change font style, size, and color. However, it is no longer recommended in modern web development.<font face=“Arial” size=“4” color=“blue”>This is old font styling</font>
2. Changing Font Using Inline CSS
Inline CSS is applied directly inside an HTML tag using the
style
attribute.
<p style=”font-family: Arial; font-size: 20px; color: blue;”> cyber tech creations.</p>3. Changing Font Using Internal CSS (Recommended for Small Projects)
Internal CSS is defined inside the
<style>
tag within the<head>
section of the HTML file.
Example:<!DOCTYPE html>
<html>
<head>
<style>
p {
font-family: ‘Times New Roman’;
font-size: 18px;
color: red;
}
</style>
</head>
<body>
<p>This is a paragraph with Times New Roman font.</p>
</body>
</html>4. Changing Font Using External CSS (Best Practice for Large Projects)
External CSS is defined in a separate
.css
file and linked to the HTML file.
Example:
p {
font-family: ‘Verdana’, sans-serif;
font-size: 16px;
color: green;
}Step 2: Link the CSS file in your HTML
<html> <head> <link rel=“stylesheet” type=“text/css” href=“styles.css”> </head> <body> <p>This paragraph uses an external CSS file for styling.</p> </body> </html>
About Lesson