How to align the two sides of the list in css (inline-block + justify)

Source: Internet
Author: User


Text-justify version: IE5 + private property inheritance: None
 
Syntax:

1. text-justify: auto | inter-word | newspaper | distriify | distribute-all-lines | inter-ideograph parameter:
 
Auto: allows the browser user agent to determine the two-end alignment rules used
Inter-word: align text by adding spaces between words. This behavior is the fastest way to align all text rows. The alignment at both ends of the paragraph is invalid for the last line of the paragraph.
Newspaper: align text by adding or removing spaces between words or letters. Is the most precise format used for alignment at both ends of the Latin alphabet
Distribute: processing spaces is similar to newspaper. It is applicable to East Asian documents. Especially Thailand
Distribute-all-lines: the two ends are in the same way as distribute, and they do not contain the last line of the two section alignment. Applies to ideographic documents
Inter-ideograph: provides full two-end alignment for ideographic text. He adds or removes spaces between ideographic words and words.
 
Note:
 
Sets or retrieves the alignment of text in an object.
The script feature is textJustify.

Applicable conditions:

1. The li spacing width of a row is smaller than the sum of the Two li widths;
2. The number of li resources is just full.

Most of condition 1 can be met, so it is mainly because the row is full.

Related code snippets

The code is as follows: Copy code

Ul {
Text-align: justify;
Text-justify: distriify;
Font-size: 0;
Letter-spacing:-4px;/* fixed the bug of inconsistent inline-block gap performance */
}
Ul li {
Display: inline-block;
* Display: inline;
* Zoom: 1;
Font-size: 12px;
Letter-spacing: 0;
Vertical-align: top;
}
Ul li. justify_fix {
Width: 100%;
Height: 0;
Line-height: 0;
Font-size: 0;
Overflow: hidden;
Margin: 0;
Padding: 0;
}

The html structure is as follows:

The code is as follows: Copy code

<Div class = "container">
<Ul>
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
<! -- A li must be blank to fix the bug -->
<Li class = "justify_fix"> </li>
</Ul>
</Div>

Related Article

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.