HTML5中margin屬性應用

貓哥的魚庫發表於2017-12-09

這裡寫圖片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
<style>
        div{
            width: 100px;
            height: 100px;
            background-color: red; 
            /* 外邊距 */
            margin-top: 30px;
            margin-left: 100px;
            margin-right: 100px;
            margin-bottom: 100px;  
            /* 連寫 */
            margin: 40px;
            margin: 0 auto;
            /* 內邊距 pandding */
            padding: 30px;
        }
</style>
</head>
<body>
  <div>div第一個</div>
  <div>div第二個</div>  
</body>
</html>

相關文章