Study/반응형 웹
[DAY 107] 반응형 웹 페이지 제작
posey
2023. 1. 2. 09:24
[DAY 107]
- UI/UX 반응형 웹디자인&웹퍼블리셔 개발자 과정 - DAY 77
Review
- UI/UX 반응형 웹디자인&웹퍼블리셔 개발자 과정 - DAY 77
<반응형 웹 페이지 만들기 예제>
- HTML
<header>
<h1></h1>
<ul id="gnb">
<li>
<a href="#"><i class="fa-solid fa-heading"></i>Hotel</a>
</li>
<li>
<a href="#"><i class="fa-regular fa-building"></i>Facility</a>
</li>
<li>
<a href="#"><i class="fa-solid fa-suitcase"></i>Business</a>
</li>
<li>
<a href="#"><i class="fa-solid fa-utensils"></i>Restaurant</a>
</li>
</ul>
<div class="snsSet">
<ul>
<li>
<a href="#"><img src="images/sns1.png" alt="sns1" /></a>
</li>
<li>
<a href="#"><img src="images/sns2.png" alt="sns2" /></a>
</li>
</ul>
<ul>
<li>
<a href="#"><img src="images/sns3.png" alt="sns3" /></a>
</li>
<li>
<a href="#"><img src="images/sns4.png" alt="sns4" /></a>
</li>
<li>
<a href="#"><img src="images/sns5.png" alt="sns5" /></a>
</li>
</ul>
</div>
</header>
<div id="util">
<ul>
<li>
<a href="#"><img src="images/util1.png" alt="util1" /></a>
</li>
<li>
<a href="#"><img src="images/util2.png" alt="util2" /></a>
</li>
</ul>
<ul>
<li>
<a href="#"><img src="images/util3.png" alt="util3" /></a>
</li>
<li>
<a href="#"><img src="images/util4.png" alt="util4" /></a>
</li>
</ul>
</div>
<section id="contents">
<article>
<div class="bg bg1"><span>Maldvies</span></div>
</article>
<article>
<div class="txt">
<i class="fa-solid fa-arrow-right"></i>
<p>
<strong>A Whole New World</strong><br /><em
>I can show you the world. Shining Shimmering Splended<br />Tell
me when you decide let me be in your heart.</em
>
</p>
</div>
</article>
<article>
<div class="txt">
<i class="fa-solid fa-sync fa-spin"></i>
<p><strong>Reservation</strong></p>
</div>
</article>
<article>
<div class="bg bg2"><span>Suite</span></div>
</article>
<article>
<div class="bg bg3"><span>Surf</span></div>
</article>
<article>
<div class="txt">
<i class="fas fa-arrow-right"></i>
<p>
<strong> A Dazzling Place</strong><br /><em
>I can show you the world. Shining Shimmering Splended<br />Tell
me when you decide.</em
>
</p>
</div>
</article>
<article>
<div class="bg bg4"><span>Sauna</span></div>
</article>
<article>
<div class="txt">
<i class="fas fa-arrow-right"></i>
<p>
<strong>Hot spot </strong><br /><em
>a best place to have a vacation<br />tell me when you decide.</em
>
</p>
</div>
</article>
<article>
<div class="bg bg5"><span>Dinner</span></div>
</article>
<article>
<div class="bg bg6"><span>Spa</span></div>
</article>
<article>
<div class="txt">
<i class="fas fa-arrow-right"></i>
<p>
<strong>Open Space </strong><br /><em>I can show you the world.</em>
</p>
</div>
</article>
<article>
<div class="bg bg7"><span>Tour</span></div>
</article>
</section>
- CSS
@charset "utf-8";
@font-face {
font-family: poiretone;
src: url(../fonts/PoiretOne-Regular.woff) format("woff"),
url(../fonts/PoiretOne-Regular.ttf) format("ttf");
}
* {
margin: 0;
padding: 0;
}
ul,
li {
list-style: none;
}
a {
text-decoration: none;
color: #555;
}
body {
overflow-x: hidden;
font: 1em poiretone, sans-serif;
}
header {
position: fixed;
left: 0;
top: 0;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
width: 15%;
height: 100%;
background: #fff;
transition: all 0.5s;
}
header h1 {
width: 180px;
height: 136px;
background: url(../images/logo1.png);
text-indent: -9999px;
}
#gnb li a {
display: block;
padding: 15px 30px;
font-size: 20px;
font-weight: 590;
}
#gnb li a:hover {
color: skyblue;
}
#gnb li i {
margin-right: 17px;
}
.snsSet {
transform: translateX(-50%);
}
.snsSet ul {
display: flex;
width: 50px;
margin: 0 auto;
}
.snsSet ul li {
}
#util {
display: flex;
justify-content: space-between;
position: relative;
left: 15%;
width: 82.9%;
height: 35px;
line-height: 35px;
background: #212121;
padding: 0 20px;
}
#util ul {
display: flex;
}
#util ul li img {
vertical-align: middle;
}
#util ul:first-child {
float: left;
}
#util ul:last-child {
float: right;
}
#contents {
position: relative;
left: 15%;
width: 85%;
}
#contents article {
float: left;
height: 260px;
}
#contents article div {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
cursor: pointer;
}
#contents article:first-child {
width: 60%;
height: 520px;
}
#contents article:nth-child(2) {
width: 40%;
}
#contents article:nth-child(3) {
width: 20%;
}
#contents article:nth-child(4) {
width: 20%;
}
#contents article:nth-child(5) {
width: 20%;
}
#contents article:nth-child(6) {
width: 40%;
}
#contents article:nth-child(7) {
width: 20%;
}
#contents article:nth-child(8) {
width: 20%;
}
#contents article:nth-child(9) {
width: 40%;
}
#contents article:nth-child(10) {
width: 20%;
}
#contents article:nth-child(11) {
width: 20%;
}
#contents article:last-child {
width: 20%;
}
#contents article .bg1 {
background: url(../images/pic1.jpg);
}
#contents article .bg2 {
background: url(../images/pic2.jpg);
}
#contents article .bg3 {
background: url(../images/pic3.jpg);
}
#contents article .bg4 {
background: url(../images/pic4.jpg);
}
#contents article .bg5 {
background: url(../images/pic5.jpg);
}
#contents article .bg6 {
background: url(../images/pic6.jpg);
}
#contents article .bg7 {
background: url(../images/pic7.jpg) no-repeat;
}
#contents article .bg {
background-size: cover;
background-position: center;
}
#contents article span {
position: absolute;
right: 20px;
bottom: 0;
font-size: 60px;
color: #fff;
opacity: 0;
transform: scale(10);
transition: all 0.8s;
}
#contents article:hover span {
transform: scale(1);
opacity: 1;
}
#contents article .bg1 span {
font-size: 170px;
bottom: -40px;
right: -10px;
opacity: 1;
transform: scale(1) rotateY(0deg);
transition: all 0.8s;
}
#contents article .bg1:hover span {
color: #333;
transform: scale(1) rotateY(360deg);
}
#contents article .txt {
color: #666;
padding: 40px 30px;
box-sizing: border-box;
}
#contents article:hover .txt {
background: #caf6ff;
/* color: #fff; */
}
#contents article .txt i {
position: absolute;
bottom: -40px;
right: -350px;
font-size: 300px;
color: #73e3fc;
transition: all 0.8s;
}
#contents article:hover .txt i {
right: 0;
opacity: 0.5;
}
#contents article:nth-child(3) .txt {
background: #73e3fc;
}
#contents article:nth-child(3) .txt i {
font-size: 200px;
color: #fff;
bottom: 0;
right: 0;
opacity: 0.5;
}
#contents article:nth-child(11) .txt {
background: #e3f1fb;
}
@media screen and (max-width: 1599px) {
header {
position: relative;
flex-direction: row;
justify-content: space-between;
width: 96%;
height: 80px;
margin: 0 20px;
}
header h1 {
width: 250px;
height: 50px;
background: url(../images/logo2.png) no-repeat;
}
#gnb {
margin-left: 100px;
}
#gnb li {
float: left;
}
#gnb li a {
font-size: 19px;
/* padding: 0 10px; */
}
#util {
left: 0;
width: 97.46%;
}
#contents {
left: 0;
width: 100%;
}
}
@media screen and (max-width: 1279px) {
header {
width: 98%;
}
#gnb {
margin-left: 0;
}
.snsSet {
display: none;
}
#contents article .txt i {
margin-right: 10px;
}
#util {
width: 96.8%;
}
#contents article .txt i {
bottom: -10px;
font-size: 250px;
}
#contents article:first-child {
width: 75%;
}
#contents article:nth-child(2) {
width: 25%;
}
#contents article:nth-child(3) {
width: 25%;
}
#contents article:nth-child(4) {
width: 25%;
}
#contents article:nth-child(5) {
width: 25%;
}
#contents article:nth-child(6) {
width: 50%;
}
#contents article:nth-child(7) {
width: 50%;
}
#contents article:nth-child(8) {
width: 25%;
}
#contents article:nth-child(9) {
width: 25%;
}
#contents article:nth-child(10) {
width: 50%;
}
#contents article:nth-child(11) {
width: 25%;
}
#contents article:last-child {
width: 25%;
}
}
@media screen and (max-width: 1023px) {
header {
width: 96%;
}
#gnb li a {
font-size: 18px;
padding: 0 10px;
}
#gnb li i {
display: none;
}
#util {
width: 96%;
}
#contents article:first-child {
width: 100%;
}
#contents article:nth-child(2) {
width: 66.666%;
}
#contents article:nth-child(3) {
width: 33.334%;
}
#contents article:nth-child(4) {
display: none;
}
#contents article:nth-child(5) {
width: 33.334%;
}
#contents article:nth-child(6) {
width: 66.666%;
}
#contents article:nth-child(7) {
display: none;
}
#contents article:nth-child(8) {
width: 33.334%;
}
#contents article:nth-child(9) {
width: 33.333%;
}
#contents article:nth-child(10) {
display: none;
}
#contents article:nth-child(11) {
width: 33.333%;
}
#contents article:nth-child(12) {
display: none;
}
}
@media screen and (max-width: 779px) {
header {
width: 94.8%;
}
header h1 {
background-size: 90%;
}
#gnb li a {
font-size: 16px;
padding: 0 5px;
}
#util {
width: 94.8%;
}
#contents article:first-child {
width: 100%;
}
#contents article:nth-child(2) {
width: 100%;
}
#contents article:nth-child(3) {
display: none;
}
#contents article:nth-child(4) {
display: none;
}
#contents article:nth-child(5) {
width: 50%;
}
#contents article:nth-child(6) {
width: 50%;
}
#contents article:nth-child(7) {
display: none;
}
#contents article:nth-child(8) {
width: 50%;
}
#contents article:nth-child(9) {
width: 50%;
}
#contents article:nth-child(10) {
display: none;
}
#contents article:nth-child(11) {
width: 50%;
}
#contents article:nth-child(12) {
display: block;
width: 50%;
}
}
@media screen and (max-width: 639px) {
header {
height: 125px;
flex-direction: column;
justify-content: space-around;
}
#gnb li a {
font-size: 20px;
padding: 0 35px;
font-weight: 600;
}
#util {
display: none;
}
article {
height: 150px;
}
#contents article:first-child {
height: 300px;
}
#contents article .txt p {
font-size: 25px;
}
#contents article .txt p em {
display: none;
}
}
@media screen and (max-width: 479px) {
header {
position: fixed;
height: 100%;
justify-content: space-around;
align-items: center;
background: transparent;
z-index: 1;
}
header h1 {
width: 180px;
height: 136px;
background: url(../images/logo1.png);
}
#gnb {
width: 70%;
margin-top: -200px;
}
#gnb li {
line-height: 50px;
width: 100%;
margin-top: 10px;
}
#gnb li a {
background: #000;
color: #fff;
opacity: 0.4;
border-radius: 10px;
}
article {
display: none;
}
#contents article:nth-child(1) {
position: fixed;
display: block;
width: 100%;
height: 100%;
}
#contents article:nth-child(1) span {
display: none;
}
#contents article:nth-child(12) {
display: none;
}
}
반응형