HTML CSS

KokoaTalk Clone Coding: CSS padding 1

jane.dev 2021. 5. 2. 14:26
반응형

Padding is the exact opposite of margin's point.

Padding is the spaces from the border of the box to the inside.

 

<html>

    <head>

        <style>

            html {

                   background-color: gray;

            }

            body {

                   margin: 0;

                   background-color: steelblue;

            }

            div {

                  height: 200px;

                  width: 200px;

                  background-color: thistle;

            }

        </style>

    </head>

    <body>

        <div></div>

    </body>

</html>

body margin: 0

<html>

    <head>

        <style>

            html {

                   background-color: gray;

            }

            body {

                   margin: 0;

                   padding: 20px;

                   background-color: steelblue;

            }

            div {

                  height: 200px;

                  width: 200px;

                  background-color: thistle;

            }

        </style>

    </head>

    <body>

        <div></div>

    </body>

</html>

body padding: 20px