html+css实战78-显示模式-块

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 块: 独占一行; 宽度默认是父级100%; 添加宽度都生效 */
        div {
            width: 300px;
            height: 300px;
            background-color: pink;

            /* 行内块 */
            /* display: inline-block; */

            /* 行内 */
            display: inline;
        }
    </style>
</head>
<body>
    <div>11111</div>
    <div>22222</div>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/geyaoisnice/article/details/125106700