본문 바로가기
HTML CSS

KokoaTalk Clone Coding: CSS border

by jane.dev 2021. 5. 2.
반응형

Border is literally border of the boxes.

 

<html>

    <head>

        <style>

             * { everything

                border: 1px solid white; width, style, color

             }

             html {

                background-color: gray;

             }

             body {

                margin: 0;

                padding: 20px;

                background-color: steelblue;

             }

             div {

                padding: 25px;

              }

              #first {

                background-color: rebeccapurple;

                height: 150px;

                width: 150px;

             }

              #second {

                background-color: olive;

                height: 100px;

                width: 100px;

             }

              #third {

                background-color: peru;

                height: 50px;

                width: 50px;

             }

        </style>

    </head>

    <body>

        <div id="first">

            <div id="second">

                 <div id="third"></div>

             </div>

        </div>

    </body>

</html>

border

 

<html>

    <head>

        <style>

             * {

                border: 1px solid white;

             }

             html {

                background-color: gray;

             }

             body {

                margin: 0;

                padding: 20px;

                background-color: steelblue;

             }

             div {

                padding: 25px;

              }

              #first {

                background-color: rebeccapurple;

                height: 150px;

                width: 150px;

             }

              #second {

                background-color: olive;

                height: 100px;

                width: 100px;

             }

              #third {

                background-color: peru;

                height: 50px;

                width: 50px;

             }

        </style>

    </head>

    <body>

        <div id="first">

            <div id="second">

                 <div id="third">

                    <span>Hello!</span>

                 </div>

             </div>

        </div>

    </body>

</html>

 

border even apply to the inline element(span)