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 Code | Result |
---|---|
Left Center Right |
Decorating Text
Below are examples of the CSS text-decoration
property for:
Source Code | Result |
---|---|
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 Code | Result |
---|---|
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 Code | Result |
---|---|
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 Code | Result |
---|---|
capitalized text (also known as title case) uppercase text TALK QUIETLY |
To do things like change font, set it to bold or italics etc, see these font codes.