Codes to Increase Text Size

Hypertext Markup Language, or HTML, and Cascading Style Sheets, or CSS, are two computer languages often used in combination to determine how a page should appear in a Web browser. HTML and CSS code can both increase text size in a Web page and you can use several different units of measurement to set the size of the font.

  1. Units of Measurement

    • HTML and CSS use points, pixels, percentages and ems to define text size. In general 100-percent is equal to 1 em, 12 points or 16 pixels. You can also use sizes "xx-small" through "xx-large" to define font size although use of these values is deprecated (in other words, discouraged from use). Ems and percentages ensure compatibility across multiple platforms, while pixels -- which are equal to a single dot on the screen -- are best for controlling the appearance of a Web page.

    Preferred Units

    • Font size is abbreviated as "px" for pixels, "pt" for "points," "em" for ems and "%" for percent. In most cases, ems, percentages and pixels should be used instead of points, as points were designed for use in print, rather than for the Web. You can, however, use points when creating printer-friendly Web pages. Ems and percentages are preferred when designing documents for the Web, since these units resize themselves depending on the visitor's resolution, unlike pixels. Using pixels can make fonts too small on other computers, particularly on Macs.

    Using CSS

    • Although both HTML and CSS can increase text size, using CSS to alter fonts is preferred, since it's more efficient. The CSS code to increase text is:

      <style>
      body { font-size: 1 em; }
      </style>

      Replace "1 em" with the desired font size. You can change "body" to another HTML element, such as "h2", "td" or "div." You can also apply the font properties to multiple elements, like so:

      body, td, table { font-size: 20 px; }

    Using HTML

    • The "<font>" tag in HTML has a "size" attribute that can increase text size in a page. Insert the desired value for the font size in between quotes:

      <font size="16 px">Place text here.</font>

      The "</font>" tag informs the browser that the font should not be altered beyond that point in the page. You can also combine HTML and CSS to increase text size:

      <font style="font-size: 120%">Place text here.</font>

      You should avoid using the "<font>" tag unless the supervisor or editor you're using does not allow you to input CSS.

Related Searches:

References

Comments

Related Ads

Featured