Css3-) Multi-Column Layout

Source: Internet
Author: User

During Multi-bar layout, the bootstrap raster system can easily achieve the effect. In fact, css3 also provides the multi-lan layout function.

For examplesectionThe label is filled with a lot of content, and you want the content to be displayed in three columns, you can use the following css to implement (Use chrome).


Set the number of Columns
section {  -webkit-column-count: 3;}

Split columns by width
section {  -webkit-column-width: 25rem;}

WhereremAndemThe font size is relative to the global one.

If you can display some labels in the column gap, the page will look more beautiful and its implementation is also very simple.


Define column gap
section {  -webkit-column-width: 25rem;  -webkit-column-rule: 3px solid #8B2101;  -webkit-column-gap: 2rem;

Wherecolumn-ruleIt can be split into the following rules:

    column-rule-width: 3px; column-rule-style: solid; column-rule-color: #8B2101;

    If you do not define a columnHeight, The content will be evenly distributed, but if the height is specified, you can also perform the column filling method.


    Fill mode of column content
    section {  column-width: 20rem;  column-rule: 3px solid #8B2101;  column-gap: 2rem;  height: 85rem;  column-fill: balance;}

    column-fillExceptbalance, There is another valueauto


    How to cross-bar

    In the table, we can usecolspan=2To configure the number of columns for content extension, of course, the column content can also be achieved through the following method.

    section img {   column-span: all;   margin: 1rem auto;}

    Other features

    Tell the browser where you want to start partitioning.
    Break-beforeauto \ always \ avoid \ column \ avoid-columnbreak-afterauto \ always \ avoid \ column \ avoid-columnbreak-insideauto \ always \ avoid \ column \ avoid-column

    Reference

    CSS Development and Design

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.