GithubHelp home page GithubHelp logo

html-css-layout's Introduction

css知识点记录

  1. 对于position:absolute,元素定位将相对于最近的一个已定位的父元素,如果没有的话相对于浏览器
  2. flex布局的知识导图:
    flex
    重点:
    1. flex-grow:定义项目的放大比例,默认为0,即存在剩余空间也不放大
    2. flex-shrink:定义项目的缩小比例,默认为1,即如果空间不足,该项目将缩小
    3. flex: 项目在容器上如何伸缩。
    1个值: 无单位:grow,有单位:basis
    2个值: 无单位:grow & shrink,有单位:grow & basis
    3个值:grow & shrink & basis
    4. flex-basis: 在不伸缩的情况下子容器的原始尺寸。主轴为横向时代表宽度,主轴为纵向时代表高度。
  3. 等分布局的实现**
    等分布局
    等分布局公式转换
  4. margin的零活运用(双飞翼布局)
    1. margin百分比
      规定基于父元素的宽度的百分比的外边距
    2. margin负边距
  5. 设置初始化ie盒模型:box-sizing:border-box
    html {
        box-sizing: border-box;
    }
    *,
    *:after,
    *:before {
        box-sizing: inherit;
    }
    选择请*无法覆盖到伪元素,所以要给:after:before分别设置,
    然后通过继承的方式应用到所有元素,方便为某个元素和其后代元素设置box-sizing:content-box
  6. body有默认8pxmargin
  7. transparent:全透明黑色
  8. :not选择器
    :not
  9. 宽高等比例缩放:
    <div class="box">
         padding
    </div>
    .box {
         width: 20%;
         background-color: pink;
     }
     .box::after {
         content: '';
         display: block;
         /* 现在伪元素的父亲是box,高度应该和box的高度相等 */
         padding-top: 100%;
     }
  10. 消失边界线:
    效果图:
    边界消失
    <div class="ul-container">
        <ul>
            <li>测试</li>
            <li>消失</li>
            <li>边界线</li>
            <li>右侧</li>
            <li>边界线</li>
            <li>消失</li>
            <li>测试</li>
        </ul>
    </div>
    .ul-container {
        overflow: hidden;
    }
    .ul-container, 
    ul{
        width:300px;
        margin-left: -1px;
    }
    li{
        float:left;
        width:99px;
        border-left:1px solid #999;
    }
    小技巧:父元素添加overflow:hiddenli添加反向边框,ul增加一个负的margin来实现

html-css-layout's People

Contributors

wangkaiwd avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.