여기서는 다자인된 웹사이트 전체를 코드를 통해서 만들어가는 과정을 함께해보겠습니다. 작은 부품이 되는 요소들을 유기적으로 결합하는 연습을 자주 해봐야 어떤 웹사이트도 만들 수 있다는 자신감이 생기게 됩니다. templated.co에서 제공하는 템플릿과 똑같은 모습으로 코딩을 해보면서 CSS로 코딩하는 감각을 익혀보시기 바랍니다.
결과물은 아래와 같이 생겼습니다. 실제 동작하는 모습을 보고 싶다면 DEMO를 방문해주세요.
작업 미리 보기
사용기술
주요개념
수업소개
배경 이미지 지정하기
헤더 - 아바타 이미지
헤더 - 슬로건
헤더 - 소셜 공유
헤더 - 다듬기
메인 - 섬네일
푸터
최종 마무리와 반응형 디자인 적용
예제
전체 파일을 다운로드 받으려면 아래 링크를 클릭하세요.
index2.html
<!DOCTYPE HTML> <!-- Visualize by TEMPLATED templated.co @templatedco Released for free under the Creative Commons Attribution 3.0 license (templated.co/license) --> <html> <head> <title>Visualize by TEMPLATED</title> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="assets/css/reset.css"> <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:200i,300,300i,400,400i" rel="stylesheet"> <link rel="stylesheet" href="fontello-bcf36fd2/css/fontello.css"> <link rel="stylesheet" href="assets/css/main2.css" /> <style> body{ background-image: url(images/bg.jpg); background-size: cover; } </style> </head> <body> <!-- Wrapper --> <div id="wrapper"> <!-- Header --> <header id="header"> <span class="avatar"><img src="images/avatar.jpg" alt="" /></span> <h1>This is <strong>Visualize</strong>, a responsive site template designed by <a href="http://templated.co">TEMPLATED</a><br /> and released for free under the Creative Commons License.</h1> <ul class="icons"> <li><a href="#" class="icon-twitter"><span class="label">Twitter</span></a></li> <li><a href="#" class="icon-facebook"><span class="label">Facebook</span></a></li> <li><a href="#" class="icon-instagram"><span class="label">Instagram</span></a></li> <li><a href="#" class="icon-mail"><span class="label">Email</span></a></li> </ul> </header> <!-- Main --> <section id="main"> <!-- Thumbnails --> <section class="thumbnails"> <div> <a href="images/fulls/01.jpg"> <img src="images/thumbs/01.jpg" alt="" /> <h3>Lorem ipsum dolor sit amet</h3> </a> <a href="images/fulls/02.jpg"> <img src="images/thumbs/02.jpg" alt="" /> <h3>Lorem ipsum dolor sit amet</h3> </a> </div> <div> <a href="images/fulls/03.jpg"> <img src="images/thumbs/03.jpg" alt="" /> <h3>Lorem ipsum dolor sit amet</h3> </a> <a href="images/fulls/04.jpg"> <img src="images/thumbs/04.jpg" alt="" /> <h3>Lorem ipsum dolor sit amet</h3> </a> <a href="images/fulls/05.jpg"> <img src="images/thumbs/05.jpg" alt="" /> <h3>Lorem ipsum dolor sit amet</h3> </a> </div> <div> <a href="images/fulls/06.jpg"> <img src="images/thumbs/06.jpg" alt="" /> <h3>Lorem ipsum dolor sit amet</h3> </a> <a href="images/fulls/07.jpg"> <img src="images/thumbs/07.jpg" alt="" /> <h3>Lorem ipsum dolor sit amet</h3> </a> </div> </section> </section> <!-- Footer --> <footer id="footer"> <p>© Untitled. All rights reserved. Design: <a href="http://templated.co">TEMPLATED</a>. Demo Images: <a href="http://unsplash.com">Unsplash</a>.</p> </footer> </div> <!-- Scripts --> <script src="assets/js/jquery.min.js"></script> <script src="assets/js/jquery.poptrox.min.js"></script> <script src="assets/js/skel.min.js"></script> <script src="assets/js/main.js"></script> </body> </html>
main2.css
#wrapper{ /* border:5px solid red;*/ } #wrapper>*{ /* border:5px solid green;*/ } #wrapper>*>*{ /* border:5px solid blue;*/ } body{ background-image: url(../../images/bg.jpg); background-size:cover; font-family: 'Source Sans Pro', sans-serif; } #wrapper{ max-width:68rem; margin:0 auto; } #header{ text-align: center; padding-top:2rem; padding-bottom: 6rem; } #header .avatar { border-radius: 100%; display:inline-block; padding:0.5rem; background-color: rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.25); margin: 2rem 0; } #header .avatar img{ border-radius: 100%; display:block; } #header h1{ font-size:1.8rem; color:rgba(255,255,255,0.5); font-weight: 200; margin-bottom: 1.5rem; line-height: 2.3rem; } #header h1 strong{ color:white; font-weight: 200; } #header h1 a{ color:rgba(255,255,255,0.5); text-decoration: none; border-bottom:1px dotted rgba(255,255,255,0.5); } #header ul.icons li{ display: inline-block; border-radius: 100%; border:1px solid rgba(255,255,255,0.25); background-color: rgba(255,255,255,0.05); width:3rem; height:3rem; display: inline-flex; justify-content: center; align-items: center; margin-right:1rem; } #header ul.icons li:hover{ border:1px solid rgba(255,255,255,0.25); background-color: rgba(255,255,255,0.2); } #header ul.icons li a{ color:rgba(255,255,255,0.5); text-decoration: none; } #header ul.icons li a:before{ font-size:1.5rem; } #header ul.icons li .label{ display: none; } #main .thumbnails { display: flex; } #main .thumbnails>div{ flex-grow: 1; margin-right:1rem; margin-left:1rem; } #main .thumbnails a{ margin-bottom: 1.5rem; display: block; } #main .thumbnails img{ width:100%; border-top-left-radius: 0.2rem; border-top-right-radius: 0.2rem; display: block; } #main .thumbnails h3{ border-left:1px solid rgba(255,255,255,0.3); border-right:1px solid rgba(255,255,255,0.3); border-bottom:1px solid rgba(255,255,255,0.3); border-bottom-left-radius: 0.2rem; border-bottom-right-radius: 0.2rem; padding:1rem; text-align: center; background-color: rgba(255,255,255,0.1); color:white; font-size:0.8rem; font-weight: 200; } #footer{ text-align: center; color:rgba(255,255,255,0.5); font-weight: 200; padding-bottom: 3rem; font-size:0.8rem; } #footer a{ color:rgba(255,255,255,0.5); text-decoration: none; border-bottom: 1px dotted rgba(255,255,255,0.5); } #footer:before{ content:''; display: block; margin:2rem auto; width:10rem; border-top:1px solid rgba(255,255,255,0.2); margin-bottom:3rem; } @media(max-width:480px){ #main .thumbnails { display: block; } }