Funky font stuff with CSS

Filed under: CSS Stylesheets

Cascading Style Sheets or CSS can be used to give your font or text a unique look. Here are some funky things you can do to your font to make it a little different from the default.

  1. Color (color)
  2. Letter Spacing (letter-spacing)
  3. Text Align (text-align)
  4. Text Decoration (text-decoration)
  5. Text Indent (text-indent)
  6. Text Transform (text-transform)
  7. Word Spacing (word-spacing)


1. Color

Easily the most common style change for fonts. Change the color of your font by using hex or rgb code.

Examples:

<div style="color:#FF0000">Examples of using hex color codes</div>

Examples of using hex color codes

<div style="color:#F00">Examples of using short form hex color codes</div>

Examples of using short form hex color codes

<div style="color:rgb(255,0,0)">Examples of using rgb color codes</div>

Examples of using rgb color codes

Go to Web-colors-explained.com for a tutorial on web colors.

2. Letter Spacing

Customize fonts with letter spacing. Letter spacing adds more (or less) white space between letters. This can dramatically alter the readability of text, so use sparingly and preferably on headings only. You can specify letter-spacing with a length in pixels (px), points (pt) or ems (em).

Examples:

<div style="letter-spacing:3px">Example of letter-spacing using pixels</div>

Example of letter-spacing using pixels

<div style="letter-spacing:3pt">Example of letter-spacing using points</div>

Example of letter-spacing using points

<div style="letter-spacing:0.5em">Example of letter-spacing using ems</div>

Example of letter-spacing using ems

3. Text Align

Text-align, as its name suggests, sets the alignment of text. Alignment can be left, right, center or justified.

Examples:

<div style="text-align:left">Left text alignment, text-align:left</div>

Left text alignment, text-align:left

<div style="text-align:right">Right text alignment, text-align:right</div>

Right text alignment, text-align:right

<div style="text-align:center">Center text alignment, text-align:center</div>

Center text alignment, text-align:center

<div style="text-align:justify">Justified text alignment, text-align:justify. Justified text alignment, text-align:justify. Justified text alignment, text-align:justify.</div>

Justified text alignment, text-align:justify. Justified text alignment, text-align:justify. Justified text alignment, text-align:justify.

4. Text Decoration

Text decoration lets you add or specify any decoration to text. Decorations can be underline, overline, line-through, blink or none.

Examples:

<div style="text-decoration:underline">Example of underlined text</div>

Example of underlined text

<div style="text-decoration:overline">Example of overlined text</div>

Example of overlined text

<div style="text-decoration:line-through">Example of line-through text</div>

Example of line-through text

<div style="text-decoration:blink">Example of blinking text</div>

Example of blinking text

<div style="text-decoration:none">Example of no text-decoration</div>

Example of no text-decoration

5. Text Indent

Using text-indent will indent the first line of text in an element. You can define the amount of text-indent using length or percentage.

Examples:

<div style="text-indent:20px">Example of text-indent using length, that is, 20 pixels.</div>

Example of text-indent using length, that is, 20 pixels.

<div style="text-indent:10%">Example of text-indent using percentage, that is, 10 percent.</div>

Example of text-indent using percnetage, that is, 10 percent.

6. Text Transform

You can transform the characters or letters of a block of text using using text-transform. You can set the text to be capitalized (first letter of each word is in capitals), uppercase (all letters are in uppercase), lowercase (all letters are in lowercase) or none.

Examples:

<div style="text-transform:capitalize">Example of capitalized text-transformed text</div>

Example of capitalized text-transformed text

<div style="text-transform:uppercase">Example of uppercase text-transformed text</div>

Example of uppercase text-transformed text

<div style="text-transform:lowercase">Example of lowercase text-transformed text</div>

Example of lowercase text-transformed text

<div style="text-transform:none">Example of no text-transformation</div>

Example of no text-transformation

7. Word Spacing

Word-spacing adjusts the space between words. You can increase or decrease the amount of space between words uses length.

Example:

<div style=”word-spacing:20px”>Exaggerated example of word-spacing using 20 pixels</div>

Exaggerated example of word-spacing using 20 pixels
divider

Leave a Comment