1) 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">
<link rel="stylesheet" href="../css/ex.css">
<title>Document</title>
<style>
</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>
2) ex.scss
* { margin: 0; padding: 0; box-sizing: border-box;}
a { text-decoration: none; color: inherit;}
li { list-style: none;}
$box-color: #333;
$white-color: #fff;
@mixin default-width ($wid: 1200px) {
width: 100%;
max-width: $wid;
margin: 0 auto;
}
@mixin flexbox ($d: row, $w: nowrap, $a: center, $j: space-between) {
display: flex;
flex-direction: $d;
flex-wrap: $w;
align-items: $a;
justify-content: $j;
}
@mixin box-style {
padding: 10px;
.graybg {
background: $box-color;
color: $white-color;
padding: 20px 20px;
padding-bottom: 80px;
margin: 10px 0;
}
background: $white-color;
}
body {
background: #ccc;
}
#wrap {
@include default-width();
}
#header {
padding: 10px 10px;
#top_title {
text-align: center;
background: $white-color;
padding: 40px;
}
#top_menu {
@include flexbox();
background: $box-color;
color: $white-color;
padding: 10px 30px;
ul {
@include flexbox();
li {
padding-right: 70px;
}
}
}
}
#content {
@include flexbox();
padding: 0 10px;
height: 100%;
.white_box {
@include box-style();
margin: 10px 0;
}
#left_content {
width: 70%;
}
#right_content {
width: 30%;
margin-left: 10px;
.white_box {
.graybg {
padding-bottom: 20px;
}
}
ul {
li:nth-child(1) {
margin-top: 10px;
}
li {
margin: 0;
padding: 20px;
}
}
}
}
#footer {
text-align: center;
background: $box-color;
color: $white-color;
padding: 20px;
margin: 0 10px;
}
3) ex_teach.scss
//변수지정
$darkgray: #333;
$lightgray: #f1f1f1;
$gray: #555;
$white: #fff;
$dpadding: 16px;
//reset
* {margin: 0; padding: 0; box-sizing: border-box;}
a { text-decoration: none; color: inherit;}
li { list-style: none;}
//mixin
@mixin flexlayout ($dir: row, $wrap: nowrap, $justify: space-between, $align: center) {
display: flex;
flex-flow: $dir $wrap;
justify-content: $justify;
align-items: $align;
}
body {
background: $lightgray;
padding: $dpadding;
}
#header {
background: $white;
text-align: center;
height: 150px;
@include flexlayout($dir: column,$justify: flex-end);
#top_title {
height: 120px;
@include flexlayout($dir: column, $justify: center);
}
#top_menu {
background: $darkgray;
color: $white;
line-height: 40px;
width: 100%;
@include flexlayout();
ul {
@include flexlayout();
}
a {
padding: 0 $dpadding*2;
}
}
}
#content {
@include flexlayout($align: flex-start);
padding-top: $dpadding;
#left_content {
width: 75%;
}
#right_content {
width: 25%;
padding-left: $dpadding;
}
.white_box {
background: $white;
padding: $dpadding;
margin-bottom: $dpadding;
div.graybg {
background: $gray;
color: $white;
padding: $dpadding;
height: 150px;
margin: $dpadding 0;
}
li.graybg {
background: $gray;
color: $white;
padding: $dpadding;
&:nth-child(1) {
margin-top: $dpadding;
}
}
}
}
#footer {
background: $gray;
text-align: center;
color: $white;
padding: $dpadding*2;
}
'노력이 좋아서' 카테고리의 다른 글
<step23>'sccs_호텔 홈페이지 따라하기' (0) | 2022.04.20 |
---|---|
<step22>'scss_삼성생명 홈페이지 따라하기' (0) | 2022.04.19 |
<step22>'scss_이자녹스 홈페이지 따라하기' (0) | 2022.04.19 |
<step21>'scss_기초' (0) | 2022.04.18 |
<step21>'css_nots 홈페이지 따라하기' (0) | 2022.04.18 |