scss_display.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>
<link rel="stylesheet" href="./css/layoutStyle.css">
</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.white_box*2 -->
<div class="white_box">
<h2>TITLE HEADING</h2>
<p>Lorem ipsum dolor 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 ipsum dolor 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">images</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">Footer</div>
<!-- 하단영역 //-->
</div>
</body>
</html>
style.scss (내가 한 것)
* { margin: 0; padding: 0; box-sizing: border-box; }
li { list-style: none; }
a { text-decoration: none; color: inherit; }
img { border: 0; }
$background_color: #f1f1f1;
$white_bg: #fff;
$white_color: #fff;
$black_bg: #333;
$black_color: #4d4d4d;
$padding: 16px;
@mixin flexlayout($dir: row, $wrap: nowrap, $just: none, $align: none) {
display:flex;
flex-direction: $dir;
flex-wrap: $wrap;
justify-content: $just;
align-items: $align;
}
#wrap {
background: $background_color;
padding: $padding;
}
#header {
height: 150px;
background: $white_bg;
text-align: center;
@include flexlayout($dir: column, $just: flex-end);
}
#top_menu {
@include flexlayout($just: space-between);
background: $black_bg;
color: $white_color;
line-height: 40px;
ul {
@include flexlayout();
}
a {
padding: 0 20px;
}
}
#top_title {
height: 110px;
@include flexlayout($dir: column, $just: center);
}
#content {
@include flexlayout();
padding-top: $padding;
> div {
&:nth-of-type(1) { // nth-of-type 써보고 싶어서 괜히 한번 써보기 ㅎ
width: 75%;
}
&:nth-of-type(2) {
width: 25%;
padding-left: $padding;
}
}
}
.white_box {
background: $white_bg;
padding: $padding;
margin-bottom: $padding;
}
.graybg {
background: $black_bg;
color: $white_color;
padding: $padding;
}
div.graybg {
height: 150px;
margin: $padding 0;
}
li.graybg:nth-child(1) {
margin-top: $padding;
}
#footer {
background: #ffe4b5;
text-align: center;
padding:20px
}
layoutStyle.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: 30px;
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;
padding: $dpadding *2;
color: $white;
}
'Stack > CSS' 카테고리의 다른 글
[CSS / SCSS] SCSS로 Style 적용하기 4 (hotel) (0) | 2022.04.20 |
---|---|
[CSS / SCSS] SCSS로 Style 적용하기 3 (Samsung) (0) | 2022.04.19 |
[CSS / SCSS] SCSS로 Style 지정하기 (Isaknox) (0) | 2022.04.19 |
[CSS / SCSS] SCSS; CSS Preprocessor / CSS 전처리기 (0) | 2022.04.18 |
[CSS] nots (페이지 따라만들기 5) (0) | 2022.04.18 |