Monday, April 10, 2017

CSS - Working with Text 2




Color
The CSS color property specifies the color of the text.
One method of specifying the color of the text is using a color name: like red, green, blue, etc. 
Here's an example of changing the color of your font.
 
The HTML:

The CSS:

Result:


Aligning Text Horizontally
The text-align property specifies the horizontal alignment of text in an element. By default, text on your website is aligned to the left. However, at times you may require a different alignment. 

text-align property values are as follows: leftrightcenter, and justify

THE HTML:

THE CSS:

Result:

Aligning Text Vertically 
The vertical-align property sets an element's vertical alignment. Commonly used values are topmiddle, and bottom.

The example below shows how to vertically align the text between the table. 

The HTML:

The CSS:

Result:

Text-decoration
The text-decoration property specifies how the text will be decorated. 

Commonly used values are:
none - The default value, this defines a normal text
inherit - Inherits this property from its parent element
overline - Draws a horizontal line above the text
underline - Draws a horizontal line below the text
line-through - draws a horizontal line through the text (substitutes the HTML <s> tag)
The HTML:
The CSS:
Result:

Indenting the Text
The text-indent property specifies how much horizontal space should be left before the beginning of the first line of the text. Property values are length (px, pt, cm, em, etc.), %, and inherit

The HTML:

The CSS:
Result:

Text-shadow
The text-shadow property adds shadow to text. 
It takes four values: the first value defines the distance of the shadow in the x (horizontal) direction, the second value sets the distance in the y (vertical) direction, the third value defines the blur of the shadow, and the fourth value sets the color

The HTML:
The CSS:

Result:

Text-transform
The text-transform CSS property specifies how to capitalize an element's text. For example, it can be used to make text appear with each word capitalized.
The HTML:

The CSS:

Result:

letter-spacing

The letter-spacing property specifies the space between characters in a text. The values can be set as:
normal defines the default style with no extra space between characters
length defines an extra space between characters using measurement units like px, pt, cm, mm, etc.;
inherit inherits the property from its parent element;moch
The HTML:
The CSS:
Result:

word-spacing
The word-spacing property specifies the space between words in a text. Just like the letter-spacing property, you can set the word-spacing values as normallength, and inherit
The HTML:
The CSS:
Result:

white-spacing
The white-space property specifies how white-space inside an element is handled. The values can be set as normalinheritnowrap, etc. 
The HTML:
The CSS:
Result:

The nowrap value suppresses all line breaks in the element. 

Related Posts

CSS - Working with Text 2
4/ 5
Oleh