How Do You Change the Font in HTML?


Quick Answer

Cascading style sheets determine the font types, sizes, weights and variants of HTML elements. While the "font" property encompasses these settings, each setting may be altered individually using the "font-family," "font-size," "font-weight" and "font-variant" properties. For example, the style="font-family:Verdana" HTML attribute setting changes the text within an element to Verdana.

Continue Reading
Related Videos

Full Answer

When defining the family of fonts with CSS, developers should enter a list of individual font names along with a generic family at the end. This technique mitigates problems when a client computer does not support a requested font. One possible setting is "font-family:Verdana,sans-serif," which attempts to use Verdana but settles for any sans-serif font if the desired font is unavailable.

Websites using HTML 4.01 or older versions may contain fonts set using the font tag. Since this tag is no longer valid with HTML5, developers now must use style sheets to change the appearance of fonts. CSS is set inline using an element's style attribute, internally using the style tag or externally using the link tag. External style sheets are ideal when styling the fonts in an entire website, while internal style sheets are ideal for styling the fonts in a single page. Inline style sheets should be reserved for individual elements.

Learn more about Computer Programming

Related Questions