CSS styles for aligning text at both ends of a paragraph

Source: Internet
Author: User

Sometimes the text in the site is more, although the parent element set the width, but always there will be uneven on both sides of the situation, looks untidy. In fact, to achieve the end of the paragraph alignment, only need to set two CSS

Style.

. Demo {       text-align: justify;        text-justify: inter-ideograph;/*ie*/}
text-justify Basic Syntaxsyntax: Text-justify:auto |inter-word | newspaper | distribute | distribute-all-lines | Inter-ideograph
Parameters:
Auto: Allows the browser user agent to determine the justification used;
Inter-word: By increasing the spacing between words, this behavior is the quickest way to align all lines of text, and its justification behavior is not valid for the last line of the paragraph;
newspaper: The most precise format used to justify the Latin alphabet by increasing or decreasing the spacing between words or letters;
Distribute: Handling spaces is much like newspaper, applicable to East Asian documents, especially Thailand;
Distribute-all-lines: Both ends of the hyphenation are the same way as distribute, also does not contain two paragraphs aligned to the last line of the paragraph, applicable to ideographic documents;
Inter-ideograph: Provides full justification for ideographic text. He increases or decreases the space between ideographic words and words. The code is as follows:
<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <title>CSS to implement paragraph text justification</title>    <style>        *{margin:0;padding:0;}. Demo{width:300px;Height:200px;margin:20px Auto;font-size:14px;Color:#0a78fa;text-align:Justify;text-justify:Inter-ideograph;/*IE*/Border:1px solid #fa5275;        }    </style></Head><Body><Pclass= "Demo">Sichuan Opera popular in Sichuan and Yunnan province, Guizhou and other provinces, is a blend of Gaoqiang, Kunqu, Qin (ie, peel), play (that is, clapper) and Sichuan folk lights play five tune art into the drama. Sichuan Opera is one of the Chinese Han Opera operas, which is popular in the Middle East of Sichuan, Chongqing and some parts of Guizhou and Yunnan. Sichuan Opera Facial makeup is an important part of Sichuan Opera Performing Arts, and it is an art treasure created and passed down by Sichuan Opera artists of all ages. Sichuan Opera by Kunqu, Gaoqiang, Qin, play, light five kinds of tune composition. </P></Body></HTML>

The effect is as follows:

Reference Link: http://blog.sina.com.cn/s/blog_7db0c22a01011emo.html

CSS styles for aligning text at both ends of a paragraph

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.