Default Display Property Block

/* Default Display Property
Block : Always starts a new line and takes full width
Inline : Does not start and only take up as much as content space
*/

index.html:


<!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>CSS Tutorial</title>
    <!-- google fonts -->
    <!-- <link href="https://fonts.googleapis.com/css2?family=Open+Sans&family=Yesteryear&display=swap" rel="stylesheet"> -->
    <link rel="stylesheet" href="styles.css">

   
</head>
<body >
    <div class="block">i'm block element</div>
    <h1 class="block">i'm block element</h1>
    <p class="block">i'm block element</p>
    <span class="inline">i'm inline element</span>
    <a href="#" class="inline">i'm inline elemnet</a>
    <img src="/detox.jpg" width="50" alt="">
</body>
</html>

css:

/* Default Display Property
Block : Always starts a new line and takes full width
Inline : Does not start and only take up as much as content space
 */
body{
    text-align: center;
}
.block{
    background: blue;
    color: white;
    width: 150px;
    margin: 20px auto;
    /* margin-left: auto;
    margin-right: auto; */
}
.inline {
    background: red;
    color: white;
}












评论

此博客中的热门博文

Nginx【Docker系列】一个反向代理神器——Nginx Proxy Manager

又一款美国免费主机,无限流量动态X10hosting

哪吒面板VPS探针搭建教程,便携服务器状态监控