The CSS property 'text-align: center' is used to align text in the center of an element. This property can be applied to any block-level or inline-level element.

When applied to a block-level element, 'text-align: center' centers the entire element, including its content. When applied to an inline-level element, it centers the text within the element.

Example:

<div style='text-align: center;'>
   <h1>Welcome to my website</h1>
   <p>This is the home page</p>
</div>

In this example, the text within the 'div' element will be centered. Both the heading ('h1') and paragraph ('p') elements will be horizontally centered within the 'div'.


原文地址: https://www.cveoy.top/t/topic/nHui 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录