HTML Font Code

View Output Full Screen Preview

The above font code sets common properties such as font size, line height, font family, and font color. Here are some more colors to choose from.

The Font Properties

When coding HTML, CSS is what you use for formatting. Here are the CSS font/text properties:

You can see some of these properties in action below.

Font Family

If you only want to specify the font family, you can use the font-family property:

View Output Full Screen Preview

Font Size

If you only want to specify the font size, you can use the font-size property. You can also use the line-height property to adjust the height of each line:

View Output Full Screen Preview

Color

If you only want to specify the font color, you can use the color property (more colors):

View Output Full Screen Preview

Bold

You can make your font bold by using the font-weight property:

View Output Full Screen Preview

If you only want to bold some of the text inline, you can use the HTML <span> tag:

View Output Full Screen Preview

Italic Text

You can make your text italic by using the font-style property:

View Output Full Screen Preview

If you only want to make some of the text italic, you can use the HTML <span> tag:

View Output Full Screen Preview