运行效果:

CSS简单样式练习(一)

 源代码:

<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>城东早春</title>
    <style type="text/css">
        *{
            margin: 0;
            padding: 0;
            border: none;
        }

        body{
            font-family: "宋体";
        }

        .container{
            width: 50%;
            margin-top: 20px;
            margin-left: 20px;
        }

        .red{
            color: red;
        }

        .blue{
            color: blue;
        }

        .bold{
            font-weight: bolder;
        }

        .text-center{
            text-align: center;
        }

        .text-right{
            text-align: right;
        }

        h4,h3,h2,h1{
            margin: 20px 0;
        }

    </style>
</head>
<body>
    <div class="container">
        <p class="red bold text-center">城东早春</p><br />
        <p class="red text-right"><i>作者:杨巨源</i></p><br />
        <h4 class="blue bold">诗家清景在新春,</h4>
        <h3>绿柳才黄半未均。</h3>
        <h2 class="blue">若待上林花似锦,</h2>
        <h1>出门俱是看花人。</h1>
    </div>
</body>
</html>