Jack N @ GitHub

Full stack engineer, focus on: Angular/React, node.js/.Net

0%

CSS面试题汇总

CSS实现水平垂直居中

  1. margin: auto;实现绝对定位元素的居中
    .center-vertical{
        width: 100px;
        height: 100px;
        background: orange;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: auto;
    }
  1. CSS3.0弹性布局
       html,
       body {
         width: 100%;
         height: 100%;
       }
       body {
         display: flex;
         align-items: center;
         justify-content: center; /* 定义body的元素水平居中 */
       }
       .content {
         width: 300px;
         height: 300px;
         background: orange;
       }
    

行内元素有哪些?块级元素有哪些?

  1. 行内元素有:a b span img input select strong
  2. 块级元素有:div ul ol li dl dt dd h1 h2 h3 h4…p
  3. 常见的空元素: <br> <hr> <img> <input> <link> <meta>

CSS3有哪些新特性?

  1. 新增各种CSS选择器 (: not(.input):)
  2. 圆角 (border-radius:8px)
  3. 多列布局 (multi-column layout)
  4. 阴影和反射 (Shadow\Reflect)
  5. 文字特效 (text-shadow)
  6. 文字渲染 (Text-decoration)
  7. 线性渐变 (gradient)
  8. 旋转 (transform)
  9. 缩放,定位,倾斜,动画,多背景



—————- END —————-






======================