Text Code

The following text codes are the ones that start with the word "text". For example, text-align, text-indent, text-shadow etc. To change the font, see the font codes.

Aligning Text

Use the CSS text-align property to align your text (or any other inline element of a block-level element):

Source CodeResult




Decorating Text

Below are examples of the CSS text-decoration property for:

Source CodeResult

Link with no underline...

Normal text with underline

Text with a line through the middle

Text with an overline

Blinking text (doesn't work on all browsers)

Indenting Text

Indent the first line of text in a paragraph with the text-indent property:

Source CodeResult

The first line of this paragraph is indented by 18 pixels. Each subsequent line is not indented.

The first line of this paragraph is indented by 2.8 em. An em defines the proportion of the letter width and height with respect to the point size of the current font.

The first line of this paragraph is indented by 35% (i.e. 35% of the containing block - not this paragraph).

The first line of this paragraph is indented by a negative amount (-8 pixels).

Create a Drop Shadow

The CSS text-shadow property accepts 4 values. The first two specify the vertical and horizontal offsets, the third one specifies the radius of the blur. The fourth value specifies the color of the drop shadow. Here are some examples:

Source CodeResult

Drop shadow 1

Drop shadow 2

Drop shadow 3

Drop shadow 4

Drop shadow 5

Transform Text

To change the case of your text, use the text-transform property. For example, you can Capitalize Text or change it from lowercase to UPPERCASE (or vice-versa). Here are examples:

Source CodeResult

capitalized text (also known as title case)

uppercase text


To do things like change font, set it to bold or italics etc, see these font codes.

About HTML.support

HTML.support was created in order to provide HTML tools, codes, tutorials, and other resources to help webmasters create and maintain their HTML documents.

HTML.support aims primarily at beginners, but may also be useful to web professionals.

About the HTML Codes

The HTML codes on this website are provided free of charge, for you to use however you wish. Feel free to modify the code to suit your own needs.

Need Hosting?

Our partner site HOSTEK provides website hosting, domain names and related products at some of the best prices on the web. If you need web hosting, check them out!