Summary of common css attributes: text-align and csstext-align in text attributes

Source: Internet
Author: User

Summary of common css attributes: text-align and csstext-align in text attributes

As mentioned above, the text-indent attribute is used to indent text. Today's text-align usage is much higher than text indent. For the current project, it is estimated that horizontal and vertical center are the most used. Let's look at its syntax first!

Text-align

Allowed value: left | center | right | justify |

The initial value is related to the user agent.

Can it be inherited?

Applicable to block-level elements

Text-align is another attribute that only adapts to block-level elements. If you want to center a link or image in a row, no matter the alignment of the remaining part of the row, it won't work. First, let's use the overall
Feel the text-align effect.

Here is the four attribute values of text-align.

 

The above display intuitively shows the property rules of text-align. The last property text-align: justify is not consistent in each browser, I personally think there are not many jusity application scenarios,

Application scenarios:

1. Text alignment: It depends on how the UI diagram is designed. In one sentence, you can design it as needed.

2. align the image in the center: it is ineffective to use text-align for img separately. Do not forget that text-align can only be used for block-level elements, but not for intra-row and non-replacement elements. So we need to modify the image center.

Solution: <div style = "text-align: center"> </div>

The Rough Discussion of text-align is here. You can try it more by yourself.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.