Front/Html, css,jsp

20201111_34 레이아웃 실습

JENN_tech7 2020. 11. 11. 12:14
728x90
SMALL
  • 내가한거
<!DOCTYPE html>
<html>
    <head>
        <title>20201111 실습</title>
        <style>
            .container {
                position: absolute;
                width: 100%;
                background-color: white;
            }
            .header {
                border: 1px solid black;
                padding: 20px;
                margin: 20px;
            }
            .article{
                width: 68%;
                border: 1px solid black;
                padding: 20px;
                margin: 20px;
            }
            .sidebar{
                width: 32%;
                border: 1px solid black;
                padding: 20px;
                margin: 20px; 
            
            }
            .footer{
                border: 1px solid black;
                padding: 20px;
                margin: 20px;
                clear: both;

            }
        </style>
    </head> 
    <body>
        <div class="container">
            <div class="header">
                <h1>이곳은 헤더</h1>
            </div>
            <div class="article">
                <h1>본문</h1>
                <p>
                    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
                </p>
            </div>
            <div class="sidebar">
            <h1>사이드바</h1>
            <ul>
            <li>리스트1</li>
            <li>리스트2</li>
        </ul>
        </div>
            <div class="footer">
                <h1>푸터</h1>
                <p>발바닥</p>
            </div>
        </div>
        </body>
    </html>

옆으로 안 붙음 ㅠ

 

 

 

 

 

  • 정답
<!DOCTYPE html>
<html>
    <head>
        <title>20201111 실습</title>
        <style>
            div {
                border: 3px solid #eeeeee;
                padding: 20px;
                margin-bottom: 20px;
                box-sizing: border-box;
            }
            .article{
                width: 68%;
                float: left;
            }
            .sidebar{
                width: 30%;
                float: right;
            }
            .footer{
                clear: both;

            }
        </style>
    </head> 
    <body>
        <div class="container">
            <div class="header">
                <h1>이곳은 헤더</h1>
            </div>
            <div class="article">
                <h1>본문</h1>
                <p>
                    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
                </p>
            </div>
            <div class="sidebar">
            <h1>사이드바</h1>
            <ul>
            <li>리스트1</li>
            <li>리스트2</li>
        </ul>
        </div>
            <div class="footer">
                <h1>푸터</h1>
                <p>발바닥</p>
            </div>
        </div>
        </body>
    </html>

float를 까먹은 것

728x90
LIST