webサイトデザインAI入門科授業用ブログ

池袋フェリカテクニカルアカデミーの求職者支援訓練の授業解説ブログです。

2カラムレイアウトの作成

f:id:yachin29:20210510141132j:plain

<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ナビゲーション付きの2カラム</title>
<link rel="stylesheet" href="css/style.css">
<style>
html,body,ul,li,p{
margin: 0;
padding: 0;
}
ul{
list-style: none;
}
a{
text-decoration: none;
color: #222;
}

body{
background-color: #d6dbdb;
}
.container{
width: 960px;
margin: 0 auto;
background-color: #FFF;
padding: 10px;
box-sizing: border-box;
}
header{
height: 300px;
background-color: cadetblue;
margin-bottom: 10px;
}
nav{
margin-bottom: 10px;
}
ul{
display: flex;
}
li{
width: 20%;
height: 50px;
}
li>a{
display: block;
text-align: center;
line-height: 50px;
background-color: crimson;
color: #FFF;
}
li>a:hover{
background-color: #e9a7a7;
color: #222;
}
li:nth-of-type(n+2)>a{
border-left: 1px solid #FFF;
}
.wrapper{
display: flex;
flex-direction: row-reverse;
margin-bottom: 10px;
justify-content: space-between;
}
.main{
width: 600px;
height: 400px;
background-color: #a9cea9;
}
.sub{
width: 330px;
height: 400px;
background-color: #f7e2aa;
}
footer{
height: 100px;
background-color: #e4b2cb;
}
footer>p{
text-align: center;
line-height: 100px;
}
</style>
</head>
<body>
<div class="container">
<header></header>
<nav>
<ul>
<li><a href="#">ボタン1</a></li>
<li><a href="#">ボタン2</a></li>
<li><a href="#">ボタン3</a></li>
<li><a href="#">ボタン4</a></li>
<li><a href="#">ボタン5</a></li>
</ul>
</nav>
<div class="wrapper">
<div class="main"></div>
<div class="sub"></div>
</div><!-- /.wrapper -->
<footer>
<p><small>&copy; 2021-05 FELICA</small></p>
</footer>
</div><!-- /.container -->
</body>
</html>