Home >Web Front-end >CSS Tutorial >How to set font position in css

How to set font position in css

王林
王林Original
2020-11-17 17:14:384665browse

How to set the font position in css: You can use the text-align attribute to set it, such as [text-align:left], which means the position is centered. The text-align attribute is used to specify the horizontal alignment of the element's text.

How to set font position in css

Related attributes:

The text-align attribute specifies the horizontal alignment of the element's text.

(Learning video sharing: html video tutorial)

Attribute value:

  • left Arrange the text to the left. Default: determined by the browser.

  • #right Arrange the text to the right.

  • #center Arrange the text to the center.

  • #justify Achieve the effect of aligning text on both ends.

  • #inherit Specifies that the value of the text-align attribute should be inherited from the parent element.

Example:

p{
    text-align: left; /* 位置居左 */
    text-align: center; /* 位置居中 */
    text-align: right; /* 位置居右 */
}

Related recommendations: html tutorial

The above is the detailed content of How to set font position in css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn