Home  >  Article  >  Web Front-end  >  How to set font to display left in css

How to set font to display left in css

王林
王林Original
2020-11-20 14:40:4712745browse

How to set the font to be displayed on the left in css: You can use the text-align attribute to set it, such as [h2 {text-align:left}]. The text-align attribute specifies the horizontal alignment of the element's text, and left means arranging the text to the left.

How to set font to display left in css

Related attribute introduction:

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

(Learning video sharing: css 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:

h1, h2, 和 h3元素设置文本的对齐方式:
h1 {text-align:center}
h2 {text-align:left}
h3 {text-align:right}

Related recommendations: CSS tutorial

The above is the detailed content of How to set font to display left 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