
- Javascript Basics Tutorial
- Javascript - Home
- Javascript - Overview
- Javascript - Syntax
- Javascript - Enabling
- Javascript - Placement
- Javascript - Variables
- Javascript - Operators
- Javascript - If...Else
- Javascript - Switch Case
- Javascript - While Loop
- Javascript - For Loop
- Javascript - For...in
- Javascript - Loop Control
- Javascript - Functions
- Javascript - Events
- Javascript - Cookies
- Javascript - Page Redirect
- Javascript - Dialog Boxes
- Javascript - Void Keyword
- Javascript - Page Printing
- JavaScript Objects
- Javascript - Objects
- Javascript - Number
- Javascript - Boolean
- Javascript - Strings
- Javascript - Arrays
- Javascript - Date
- Javascript - Math
- Javascript - RegExp
- Javascript - HTML DOM
- JavaScript Advanced
- Javascript - Error Handling
- Javascript - Validations
- Javascript - Animation
- Javascript - Multimedia
- Javascript - Debugging
- Javascript - Image Map
- Javascript - Browsers
- JavaScript Useful Resources
- Javascript - Questions And Answers
- Javascript - Quick Guide
- Javascript - Functions
- Javascript - Resources
How to change text font in HTML?
To change the text font in HTML, use the style attribute. The style attribute specifies an inline style for an element. The attribute is used with the HTML <p> tag, with the CSS property font-family, font-size, font-style, etc.
HTML5 do not support the <font> tag, so the CSS style is used to change font. The <font> tag deprecated in HTML5.
Just keep in mind, the usage of style attribute overrides any style set globally. It will override any style set in the HTML <style> tag or external style sheet.
Example
You can try to run the following code to change the font in HTML
<!DOCTYPE html> <html> <head> <title>HTML Font</title> </head> <body> <h1>Our Products</h1> <p style = "font-family:georgia,garamond,serif;font-size:16px;font-style:italic;"> This is demo text </p> </body> </html>
- Related Articles
- How to change text font for JLabel with HTML in Java?
- How to change font size in HTML?
- How to set text font family in HTML?
- How do we set text font in HTML?
- How to change the font family of Text using FabricJS?
- How to change the font size of Text using FabricJS?
- How to change the font style of Text using FabricJS?
- How to change the font weight of Text using FabricJS?
- How to change font-weight of a text using JavaScript?
- How to change font size with HTML in Java Swing JEditorPane?
- How to change the font color of a text using JavaScript?
- How to change the font size of a text using JavaScript?
- How to change the font-weight of a text using JavaScript?
- How to change the text color of font in the legend using Matplotlib?
- How to change font-weight of a canvas-type text using Fabric.js?

Advertisements