
- 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 set text font family in HTML?
To change the text font family 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. HTML5 do not support the <font> tag, so the CSS style is used to add font size.
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 text font family in an HTML page
<!DOCTYPE html> <html> <head> <title>HTML Font Family</title> </head> <body> <h1>Our Products</h1> <p style="font-family:georgia,garamond,serif;"> This is demo text </p> </body> </html>
- Related Articles
- How to set the font family for text with JavaScript?
- How do we set text font in HTML?
- How to change the font family of Text using FabricJS?
- How to change text font in HTML?
- Set the font family with CSS
- How to set default font family for entire Android App?
- How to set font color in HTML?
- How to set font for Text in Tkinter?
- How to set font to text node in JavaFX?
- How to set font for text in JTextPane with Java?
- How to set Text alignment in HTML?
- How to set text direction in HTML?
- Font Family in CSS
- How to change text font for JLabel with HTML in Java?
- How to set the font size of text with JavaScript?

Advertisements