Text in CSS:
Text in CSS: In CSS(Cascading Style Sheets), text can be styled using various properties. Some examples have been given below:
Text color: This property is used to set the color of the text. It can be set in various ways such as by using a color name, RGB values, or hexadecimal values. Example:
color: red;
Text alignment: This property is used to set the horizontal alignment of the text within its container. It can be set to left, right, centre or justify. Example:
text-align: centre;
Text decoration: This property is used to add decoration to the text such as underlining, overline, or line-through. For example:
text-decoration: underline;
Text transformation: CSS provides the text-transform property, which can be used to transform the case of the text. The text-transform property accepts four possible values:
uppercase, lowercase, capitalize,
andnone
. For example, to transform all text to uppercase, we can use:text-transform: uppercase;
Text shadow: CSS provides the
text-shadow
property, which can be used to add a shadow effect to the text. Thetext-shadow
property accepts three values: the x-offset, the y-offset, and the blur radius of the shadow. For example, to add a black shadow to text with a horizontal offset of 2px, a vertical offset of 2px, and a blur radius of 1px, we can use:text-shadow: 2px 2px 1px black;
Text indentation: The 'text-indent' property sets the amount of space that should be used for the first line of text in a block. For example, to indent the first line of a paragraph by 20 pixels, we can use:
p {
text-indent: 20px;
}
Note: These are just a few examples of the text-related properties. There are many more properties available in css except them. By using these we can customize the appearance of text on our website.