CSS Typography Parameter Details
- font-style - italics or oblique
- font-variant - normal or small-caps
- font-weight - normal, bold or numeric from 100 to 900.
- font-size - The font size given in %, px, em, or any other valid CSS measurement
- line-height - The line-height given in %, px, em, or any other valid CSS measurement
- font-family - This is for defining the family's name.
- color - Any valid CSS color representation, like red, #00FF00, hsl(240, 100%, 50%) etc.
- font-stretch - Whether or not to use a confenced or expanded face from font. Valid values are normal, ultracondensed, extra-condensed, condensed, semi-condensed, semi expanded, expanded, extraexpanded or ultra-expanded
- text-align - start, end, left, right, center, justify, match-parent
- text-decoration - none, underline, overline, line-through, initial, inherit;
The Font Shorthand
With the syntax:
You can have all your font-related styles in one declaration with the font shorthand. Simply use the font property, and put your values in the correct order.
For example, to make all p elements bold with a font size of 20px and using Arial as the font family typically you would code it as follows:
However, with the font shorthand, it can be condensed as follows:
Initial value for each of the properties:
- font-style: normal;
- font-variant: normal;
- font-weight: normal;
- font-stretch: normal;
- font-size: medium;
- line-height: normal;
- font-family – depends on user agent
The quotes property is used to customize the opening and closing quotation marks of the <q> tag.
The text inside #element-one will be 30px in size, while the text in #element-two will be 10px in size.
The direction property is used to change the horizontal text direction of an element.
The writing-mode property changes the alignment of text so it can be read from top-to-bottom or from left-to-right, depending on the language.
The browser will attempt to apply the font face "Segoe UI" to the characters within the elements targeted by the above property. If this font is not available, or the font does not contain a glyph for the required character, the browser will fall back to Tahoma, and, if necessary, any sans-serif font on the user's computer. Note that any font names with more than one word such as "Segoe UI" need to have single or double quotes around them.
The browser will attempt to apply the font face "Consolas" to the characters within the elements targeted by the above property. If this font is not available, or the font does not contain a glyph for the required character, the browser will fall back to "Courier New," and, if necessary, any monospace font on the user's computer.
The text-overflow property deals with how overflowed content should be signaled to users. In this example, the ellipsis represents clipped text.
Unfortunately, text-overflow: ellipsis only works on a single line of text. There is no way to support ellipsis on the last line in standard CSS, but it can be achieved with non-standard webkit-only implementation of flexboxes.
To add shadows to text, use the text-shadow property. The syntax is as follows:
Shadow without blur radius
This creates a blue shadow effect around a heading
Shadow with a blur radius
To add a blur effect, add an option blur radius argument
To give an element multiple shadows, separate them with commas
The text-transform property allows you to change the capitalization of text. Valid values are: uppercase, capitalize, lowercase, initial, inherit, and none
The letter-spacing property is used to specify the space between the characters in a text.
! letter-spacing also supports negative values:
The text-indent property specifies how much horizontal space text should be moved before the beginning of the first line of the text content of an element.
The text-decoration property is used to set or remove decorations from text.
text-decoration can be used in combination with text-decoration-style and text-decoration-color as a shorthand property:
This is a shorthand version of
It should be noted that the following properties are only supported in Firefox
The word-spacing property specifies the spacing behavior between tags and words.
- a positive or negative length (using em px vh cm etc.) or percentage (using %)
- the keyword normal uses the font's default word spacing
- the keyword inherit takes the value from the parent element
Default attribute of fonts.
Sets every letter to uppercase, but makes the lowercase letters(from original text) smaller in size than the letters that originally uppercase.
ATutorialHub Related Guide
panduranga gupta2021-07-05 07:03:13
good website for learning and help me a lot
The awsome website i am looking like for a long time, good work atutorialhub team keep doing
Learning a lot from the courses present on atutorialhub. The courses are very well explained. Great experience
It is very helpful to students and easy to learn the concepts
Great job Tutorials are easy to understand Please make use of it
Zain Khan2021-09-18 15:07:23
Great content and customized courses.
Rudrakshi Bhatt2021-09-09 15:08:10
Well structured coursed and explained really well!
Pavana Somashekar2021-09-11 15:09:08
Good platform for beginners and learn a lot on this website