• css学习笔记


    1、浏览器默认都会有一些内外边距,并且值还不一样,所以,实际开发都会清空内外边距

    * {
                margin: 0;
                padding: 0;
            }
    

    2、能够使块元素居中对齐的方案。1:设置块元素的宽度 2:设置margin:0 auto样式。其中上下边距可以不是0。

                 900px;
                height: 200px;
                background-color: pink;
                margin: 100px auto;
                text-align: center;
            }
    

    3、解决父元素和子元素外边距塌陷得到问题。

        <style>
            .father {
                 400px;
                height: 400px;
                background-color: purple;
                margin-top: 50px;
                /* 解决父元素外边距塌陷的问题 又三种解决方案 */
                /* 解决方案1:为父元素添加边框 */
                /* border: 1px solid red; */
                /* 解决方案2:为父元素添加内边距 */
                /* padding-top: 1px; */
                /* 解决方案3:为父元素添加overflow:hidden */
                overflow: hidden;
            }
            .son {
                 200px;
                height: 200px;
                background-color: pink;
                margin-top: 100px;
            }
        </style>
        <div class="father">
            <div class="son"></div>
        </div>
    

    4、

  • 相关阅读:
    923c C. Perfect Security
    hdu ACM Steps Section 1 花式A+B 输入输出格式
    我回来了
    POJ–2104 K-th Number
    bzoj1009: [HNOI2008]GT考试
    bzoj1875: [SDOI2009]HH去散步
    1898: [Zjoi2005]Swamp 沼泽鳄鱼
    Hadoop
    程序员的自我修养
    Effective C++笔记
  • 原文地址:https://www.cnblogs.com/caoruipeng/p/16096375.html
Copyright © 2020-2023  润新知