본문 바로가기

개발관련/front-end

레이아웃 잡기

728x90

 

가변길이를 주어 width를 %로 설정하면

main(content + right) 가 전체로 꽉 채워진다.

 

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">

body {
margin: 0 auto;
background-color: #E1DDDB;
height: 100px;
}


header {
background-color: #0C4A60;
width: 100%;
height: 70px;
padding: 20px;
text-align: left;

}

.nav {
display: block;
height: 40px;
padding: 0;
vertical-align: top;
background-color: #EF6C33; /*오렌지*/
width: 300px;

}

.nav a {
position: relative;
float: left;
    display: block;
    color: #f2f2f2;
    text-align: center;
    font-size: 16px;
    padding-top: 8px;
    text-decoration: none;
    width: 100px;
    height: 40px;
}

.nav a:hover {
font-weight: bold;
background-color: #6C7A89;
    color: black;
}

.main {
margin: 0 auto;
padding: 0;
vertical-align: top;
background-color: #EF6C33; /*오렌지*/
width: 1200px;


}

.content {
background-color: #E0E7E9;
float: left;
width: 75%;
height: 1000px;
}


.right-side {
display: inline-block;
background-color: #6C7A89;
float: left;
width: 25%;
height: 1000px;
}

footer {

background-color: white;
clear: both;
width: 100%;
height: 100px;

}


</style>
</head>
<body>
<header>
<h1>header</h1>
</header>
<main class="main">
<div class="content"><h1>content</h1></div>
<div class="right-side">
<div class="nav">
<a href="#">Logout</a>
<a href="#">User Home</a>
<a href="#">Main</a>
</div>
<h1>right-side</h1>
</div>
</main>
<footer><h1>footer</h1></footer>


</body>
</html>