CSS Outline, CSS Texts, CSS Fonts
CSS Outline, CSS Texts, CSS Fonts
CSS Outline, CSS Texts, CSS Fonts
Samir Rana
An outline is a line that is drawn around elements, OUTSIDE the
borders, to make the element "stand out".
Example: outline: #4CAF50 solid 10px;
Diagramatic Representation
CSS has the following outline properties:
outline-style
outline-color
outline-width
outline-offset
Outline
Outline Style
The outline-width property specifies the width of the
outline, and can have one of the following values:
thin (typically 1px)
medium (typically 3px)
thick (typically 5px)
A specific size (in px, pt, cm, em, etc)
Outline Color
The outline property is a shorthand property for
setting the following individual outline properties:
outline-width
outline-style (required)
outline-color
Outline Offset
Text Color
The color property is used to set the color of the text.
CSS Text
The text-align property is used to set the horizontal
alignment of a text.
A text can be left or right aligned, centered, or
justified.
Left alignment is default if text direction is left-to-
right, and right alignment is default if text direction
is right-to-left.
Text Alignment
When the text-align property is set to "justify",
each line is stretched so that every line has equal
width, and the left and right margins are straight
(like in magazines and newspapers):
The text-decoration property is used to set or remove
decorations from text.
The value text-decoration: none; is often used to
remove underlines from links:
Text Decoration
The text-transform property is used to specify
uppercase and lowercase letters in a text.
Text Transformation
Text Indentation
The text-indent property is used to specify the indentation of the
first line of a text.
Letter Spacing
The letter-spacing property is used to specify the space
between the characters in a text.
Line Height
The line-height property is used to specify the space between
lines
Word Spacing
The word-spacing property is used to specify the space
between the words in a text.
Text Spacing
The text-shadow property adds shadow to text.
In its simplest use, you only specify the horizontal
shadow (2px) and the vertical shadow (2px):
Example: text-shadow: 2px 2px;
Next, add a color (red) to the shadow:
Example: text-shadow: 2px 2px red;
Then, add a blur effect (5px) to the shadow:
Example: text-shadow: 2px 2px 5px red;
Text Shadow
The CSS font properties define the font family,
boldness, size, and the style of a text.
CSS Fonts
The font family of a text is set with the font-family property.
Start with the font you want, and end with a generic family, to let the
browser pick a similar font in the generic family, if no other fonts are
available.
Note: If the name of a font family is more than one word, it must be in
quotation marks, like: "Times New Roman".
Font Family
The font-style property is mostly used to specify italic text.
This property has three values:
normal - The text is shown normally
italic - The text is shown in italics
oblique - The text is "leaning" (oblique is very similar to italic, but less
supported)
Font Weight
The font-weight property specifies the weight of a font:
Font Variant
The font-variant property specifies whether or not a text should be displayed in a
small-caps font.
In a small-caps font, all lowercase letters are converted to uppercase letters.
However, the converted uppercase letters appears in a smaller font size than the
original uppercase letters in the text.
Relative size:
Sets the size relative to surrounding elements
Allows a user to change the text size in browsers
Note: If you do not specify a font size, the default size for normal text, like
paragraphs, is 16px (16px=1em).
Font Size
Setting the text size with pixels gives you full control
over the text size:
Google Fonts
To shorten the code, it is also possible to specify all the individual
font properties in one property.