zoukankan      html  css  js  c++  java
  • CSS3多栏样式布局

    看书的时候,遇到了CSS3一个新的多栏布局样式属性,测试了一下,贴段代码出来:

    目前这个属性还是需要带上浏览器内核的私有前缀:

    先看html代码:

    1 <BODY>
    2     <div class='main'>
    3         <p>My father was a self-taught mandolin player. He was one of the best string instrument players in our town. He could not read music, but if he heard a tune a few times, he could play it. When he was younger, he was a member of a small country music band. They would play at local dances and on a few occasions would play for the local radio station. He often told us how he had auditioned and earned a position in a band that featured Patsy Cline as their lead singer. He told the family that after he was hired he never went back. Dad was a very religious man. He stated that there was a lot of drinking and cursing the day of his audition and he did not want to be around that type of environment.</p>
    4         <p>My father was a self-taught mandolin player. He was one of the best string instrument players in our town. He could not read music, but if he heard a tune a few times, he could play it. When he was younger, he was a member of a small country music band. They would play at local dances and on a few occasions would play for the local radio station. He often told us how he had auditioned and earned a position in a band that featured Patsy Cline as their lead singer. He told the family that after he was hired he never went back. Dad was a very religious man. He stated that there was a lot of drinking and cursing the day of his audition and he did not want to be around that type of environment</p>
    5         <p>My father was a self-taught mandolin player. He was one of the best string instrument players in our town. He could not read music, but if he heard a tune a few times, he could play it. When he was younger, he was a member of a small country music band. They would play at local dances and on a few occasions would play for the local radio station. He often told us how he had auditioned and earned a position in a band that featured Patsy Cline as their lead singer. He told the family that after he was hired he never went back. Dad was a very religious man. He stated that there was a lot of drinking and cursing the day of his audition and he did not want to be around that type of environment.</p>
    6     </div>
    7 </BODY>

    正常的显示方法是:每个p标签的内容会铺满body的宽度,各占一行.

    但是加上css3中的多栏样式属性后,代码:

    .main{
            /*  设置每列的宽度   */
            -webkit-column-width:400px;
    
            /*  把网页分成三列   */
            -webkit-column-count:3;
    
    
            /* 列之间的间距 */
            -webkit-column-gap:50px;
    
            
            /* 设置栏目分割线 */
            -webkit-column-rule:thin solid #999; 
            -moz-column-rule:thin solid #999;
            -moz-column-count:3;
                 column-count:3;
        }

    得到的结果如下图:

    是不是很简单...就这样

  • 相关阅读:
    SqlServer该如何合适的索引
    SqlServer该如何合适的索引
    SQLServer跨库查询分布式查询
    SQLServer跨库查询分布式查询
    sqlserver 字符串能不能执行
    WPF添加类库并引用
    StringUtils类常用方法
    如何理解.NET开发中的x86/x64/AnyCPU
    JS获取url参数
    MySQL CONCAT函数:字符串拼接
  • 原文地址:https://www.cnblogs.com/hellome/p/3998597.html
Copyright © 2011-2022 走看看