CSS overflow property and initialization Detailed

CSS Initialization

1.将页面中标签默认的样式(内外边距,文字大小,文字颜色,文字字体...)恢复到原始的状态
2.将页面中标签的样式设置为统一的样式
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>

    <style type="text/css">
        /* 初始化 */
        body,p,h1,h2,h3,h4,h5,h6,ul,ol,dl,dt,dd,li {
            margin: 0;
            padding: 0;
            /* 设置统一的样式 */
            font-size: 16px;
            font-family: "宋体";
            color: red;
        }

        input {
            border:none;
            outline-style: none;
            padding: 0;
        }
        
        .w {
            width: 980px;
            margin: 0 auto;
        }

        /*清除浮动*/
        .clearfix:after {
            content: "";
            height: 0px;
            line-height: 0px;
            display: block;
            clear: both;
            visibility: hidden;
        }
        .clearfix {
            *zoom: 1;
        }
    </style>
</head>
<body>
<p>空白格</p>
<h1>其实都没有</h1>

<ul>
    <li>
        杨宗纬
    </li>
</ul>


<input type="text">

</body>
</html>

Here Insert Picture Description

Detailed overflow property

/* 默认超出父元素的内容也是可见 */
overflow: visible;

/* 将超出父元素的内容部分进行隐藏 */
overflow: hidden;


/* 如果内容超出父元素或者没有超出滚动条,会给父元素添加一个滚动条 */
overflow: scroll;

/* 如果内容超出父元素那么就添加滚动条,否则不添加 */
overflow: auto;
Published 29 original articles · won praise 3 · Views 381

Guess you like

Origin blog.csdn.net/dwjdj/article/details/104077324