
Set it to the value you want and place it inside a style attribute. To change font size in HTML, use the CSS font-size property. Now that we understand how to change font type, let’s turn our attention to font size. You can use external CSS with plain CSS code, or paired with a framework like Bootstrap CSS. I could use the CSS selector “p” to target all paragraphs: Want to learn more about HTML? Download our free guide for best practices for getting started with HTML.įor example, let’s say I want to change the font of every paragraph element to Arial. Learn More: The Beginner's Guide to HTML & CSS Instead, just target all of one type of element with a CSS selector. For most developers, this is considered the correct way to change the font face in HTML because you don’t need to copy and paste the same style rules into each tag. While inline CSS works fine for changing a single element on the page, we recommend other styles of CSS, namely external CSS, over inline CSS.Įxternal CSS is placed in a CSS file, separated from the HTML. See the Pen How to Change Font Type in HTML by HubSpot ( on CodePen.

The other paragraph and headings on the page will remain as Times New Roman, the default font type in most browsers. I’ll add the style attribute to the first paragraph element, which means only this paragraph will be styled. Let’s look at a basic example: using inline CSS to change the font type of a paragraph.
