How do you change font size in html?


Quick Answer

To change the font size of text content in a Web page coded in HTML, apply the CSS "font-size" style property to the HTML element holding it. The "font-size" property accepts named sizes (small, medium, large, etc.), fixed sizes (in px, cm, em, etc.) and percentages as values.

Continue Reading

Full Answer

  1. Identify the HTML element to modify

    In your HTML code, identify the HTML element that holds the text you want to modify. If you only want to modify the font size of a portion of a larger element (a "p" or "div," for example), you can elect to enclose the length of it in a "span" element.

  2. Add the "style" attribute to the element

    If the HTML element does not already have a "style" attribute, add it to the opening HTML tag by inserting ' style="" ' between the its name and the greater-than symbol. Set your cursor between the double quotation marks. Otherwise, if the HTML element already has a "style" attribute, set your cursor directly after the first double quotation mark of the existing "style" attribute.

  3. Add the "font-size" property

    Type "font-size: " and then add the desired font size value after it. Terminate the CSS property by adding a semicolon after the value. The inserted style attribute should resemble ' style="font-size: 12px;" '.

  4. Save your code and test the changes

    Save your code. If your page was already open when you made the modification, you must reload it to see any meaningful changes.

Learn more about Computer Programming

Related Questions