1) flex_layout.html
<!DOCTYPE html>
<html lang="en">
<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>Document</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box;}
#parent {
width: 1000px;
background-color: lightblue;
height: 500px;
margin: 0 auto;
display: flex;
flex-direction: row; /*default*/
/*flex-wrap: nowrap; /*default*/
/*align-items: stretch; /*default*/
flex-wrap: wrap-reverse;
justify-content: space-between;
/* align-items: center; */
/* align-content: space-between; */
align-items: flex-start;
}
.item {
width: 300px;
height: 100px;
background-color: blue;
}
.item:nth-child(3) {
background-color: tomato;
}
</style>
</head>
<body>
<div id="parent">
<div class="item">div1</div>
<div class="item">div2</div>
<div class="item">div3</div>
<div class="item">div4</div>
<div class="item">div5</div>
</div>
</body>
</html>
2) flex_ex.html
<!DOCTYPE html>
<html lang="en">
<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>Document</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box;}
a { text-decoration: none; color: inherit;}
#wrap {
width: 1200px;
margin: 0 auto;
}
li { list-style: none;}
#header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 40px 0;
}
#header ul {
display: flex;
/* justify-content: flex-end; */
}
#header li {
padding: 10px;
}
#content h2 {
text-align: center;
border-bottom: 1px solid #333;
padding: 20px;
}
#content ul {
display: flex;
justify-content: space-between;
padding: 20px 0;
}
#content ul li {
border: 1px solid #ccc;
width: 31%;
text-align: center;
padding: 20px;
}
#notice h2 {
text-align: center;
border-bottom: 1px solid #333;
padding: 20px;
margin-bottom: 20px;
}
#notice li {
border-bottom: 1px solid #ccc;
padding: 10px;
}
#notice ul {
margin-bottom: 20px;
}
#footer {
display: flex;
justify-content: space-between;
}
</style>
</head>
<body>
<div id="wrap">
<div id="header">
<h1><a href="#">Green</a></h1>
<ul>
<li><a href="#">menu1</a></li>
<li><a href="#">menu2</a></li>
<li><a href="#">menu3</a></li>
<li><a href="#">menu4</a></li>
</ul>
</div>
<div id="main">
<div id="content">
<h2>메인 컨텐츠01</h2>
<ul>
<li>
<h3>작은제목 입니다.</h3>
<p>내용적는 부분입니다.</p>
<span>2020.12.17</span>
</li>
<li>
<h3>작은제목 입니다.</h3>
<p>내용적는 부분입니다.</p>
<span>2020.12.17</span>
</li>
<li>
<h3>작은제목 입니다.</h3>
<p>내용적는 부분입니다.</p>
<span>2020.12.17</span>
</li>
</ul>
</div>
<div id="notice">
<h2>공지사항</h2>
<ul>
<li>그린 컴퓨터 아카데미 소식<span>2020.12.17</span></li>
<li>코로나 바이러스 예방법<span>2020.12.17</span></li>
<li>그린 컴퓨터 아카데미 소식<span>2020.12.17</span></li>
<li>코로나 바이러스 예방법<span>2020.12.17</span></li>
</ul>
</div>
</div>
<div id="footer">
<p>주소 : 서울특별시 용산구 한강대로 대표이사: 그린 사업자 등록번호 : 110-12-12345 통신판매 신고: 제 2020-서울용산-000호</p>
<h1>Green</h1>
</div>
</div>
</body>
</html>
3) flex_ex2.html
<!DOCTYPE html>
<html lang="en">
<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>Document</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box;}
a { text-decoration: none; color: inherit;}
li { list-style: none;}
body {
background-color: #ccc;
}
#wrap {
width: 1200px;
margin: 0 auto;
background-color: #ccc;
}
#header {
border: 1px solid #ccc;
background-color: #fff;
margin-top: 20px;
}
#top_title {
text-align: center;
padding: 30px;
}
#top_menu ul {
display: flex;
}
#top_menu ul li:first-child {
padding-left: 20px;
}
#top_menu ul li:not(:first-child) {
padding-left: 60px;
}
#top_menu > a {
padding-right: 20px;
}
#top_menu {
display: flex;
justify-content: space-between;
padding: 5px;
background-color: #555;
color: #fff;
}
.graybg {
background: #555;
color: #fff;
padding: 16px;
}
div.graybg {
height: 180px;
margin: 10px 0;
}
#content > div > div {
border: 1px solid #ccc;
background-color: #fff;
margin-top: 8px;
padding: 8px;
}
#content {
display: flex;
}
#left_content {
width: 75%;
margin-right: 8px;
}
#footer {
text-align: center;
background-color: #555;
color: #fff;
margin: 10px 0;
padding: 8px;
}
</style>
</head>
<body>
<div id="wrap">
<!-- 상단영역 -->
<div id="header">
<div id="top_title">
<h1>My Website</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
<div id="top_menu">
<ul>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
</ul>
<a href="#">link</a>
</div>
</div>
<!-- 상단영역 / -->
<!-- 본문영역 -->
<div id="content">
<div id="left_content">
<div class="white_box">
<h2>TITLE HEADING</h2>
<p>Lorem ipsumdolor sit amet</p>
<div class="graybg">image</div>
<h3>Title text</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
<div class="white_box">
<h2>TITLE HEADING</h2>
<p>Lorem ipsumdolor sit amet</p>
<div class="graybg">image</div>
<h3>Title text</h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
</div>
</div>
<div id="right_content">
<div class="white_box">
<h2>About Me</h2>
<div class="graybg">image</div>
<p>Some text about me in culpa qui officia deserunt mollit anim..</p>
</div>
<div class="white_box">
<h2>Popular Post</h2>
<ul>
<li class="graybg">image</li>
<li class="graybg">image</li>
<li class="graybg">image</li>
</ul>
</div>
<div class="white_box">
<h2>Follow Me</h2>
<p>Some text..</p>
</div>
</div>
</div>
<!-- 본문영역 / -->
<!-- 하단영역 -->
<div id="footer">
<p>Footer</p>
</div>
<!-- 하단영역 / -->
</div>
</body>
</html>
4) flex_ex2_teach.css
* { margin: 0; padding: 0; box-sizing: border-box;}
a { text-decoration: none; color: inherit;}
li { list-style: none;}
#wrap {
background: #f1f1f1;
padding: 16px;
}
#header {
display: flex;
flex-direction: column;
justify-content: flex-end;
height: 150px;
background-color: #fff;
text-align: center;
}
#top_menu {
display: flex;
justify-content: space-between;
background-color: #333;
color: #fff;
line-height: 40px;
}
#top_title {
height: 110px;
display: flex;
flex-direction: column;
justify-content: center;
}
#top_menu ul {
display: flex;
}
#top_menu a { padding: 0 20px;}
#content {
display: flex;
padding-top: 16px;
}
#left_content {
width: 75%;
}
#right_content {
width: 25%;
padding-left: 16px;
}
.white_box {
background-color: #fff;
padding: 16px;
margin-bottom: 16px;
}
.graybg {
background-color: #555;
color: #fff;
padding: 16px;
}
div.graybg {
height: 150px;
margin: 16px 0;
}
li.graybg:nth-child(1) {
margin-top: 16px;
}
#footer {
background-color: #666;
text-align: center;
padding: 20px;
color: #fff;
}
'노력이 좋아서' 카테고리의 다른 글
<step20>'css_반응형_media' (0) | 2022.04.15 |
---|---|
<step19>'css_flex실습' (0) | 2022.04.15 |
<step18>'css_hover,position_실습' (0) | 2022.04.13 |
<step17>'css_position' (0) | 2022.04.12 |
<step17>'css_hover' (0) | 2022.04.12 |