Text-align: justify: an example of how to align the two ends

Source: Internet
Author: User

Text-align: justify can only align the two ends of non-last rows in multiple rows. I can't help myself with a single line. IE has text-justify to solve the problem. For non-IE, my method is junk, because it is only used in special cases.

The code is as follows: Copy code
. Justify {
Height: 1.1em;
Overflow: hidden;
Text-align: justify;
Text-justify: distribute-all-lines;
}
Div.cn: after {
Content :"__________________________________________";
Font-size: 100px;

By the way, I use content and add content to the second line to align the two ends of the first line.
However, different browsers have different understandings of Chinese. Firefox separates Chinese characters directly, and Opera does not separate Chinese characters. It only recognizes spaces. If a Chinese character is entered with a half-width English or number, safari is close to Opera. It cannot be divided without spaces.
The English is better, because we can only use spaces to separate words, but IE uses text-justify: distribute-all-lines to separate words. I used to think about how to use htc or js to help IE, but I found that IE6 is so stupid that I don't know how to use IE7 at home.
Or it is better to press the space, but firefox, a browser that only zooms in the text, is XX. The bad method I wrote is only useful under certain conditions, think of one sentence: cherish life and stay away from Firefix!
The CSS code is as follows:

The code is as follows: Copy code

# Example {padding: 10px; width: 400px; text-align: justify; text-justify: inter-ideography; border: 1px solid blue ;}

The HTML code is as follows:

<Html>
<Body>
<P id = "example">
The core technology is: Power supply is provided to the equipment in the cabinet in a small space, so that the current distribution and balance of the equipment, power cable arrangement specifications, safe and reliable plug-in, switch control can be installed, surge protection, overload protection and current parameter display to ensure the lowest temperature rise of the connector.
</P>
</Body>
</Html>

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.