Study/HTML5 & CSS3
HTML5 & CSS3 : 동적인 메뉴
posey
2022. 11. 18. 23:08
2022.11.18.
- UI/UX 반응형 웹디자인&웹퍼블리셔 개발자 과정 - DAY 46
Review
비대면 수업 3일차
- UI/UX 반응형 웹디자인&웹퍼블리셔 개발자 과정 - DAY 46
- HTML
<ul>
<li><a href="#" id="about">About</a></li>
<li><a href="#" id="blog">Blog</a></li>
<li><a href="#" id="project">Project</a></li>
<li><a href="#" id="contact">Contack</a></li>
</ul>
- CSS
@charset "utf-8";
@font-face {
font-family: montserrat;
src: url(../fontawesome-free-6.2.0-web/webfonts/Montserrat-Italic-VariableFont_wght.woff) format("woff");
}
@font-face {
font-family: notosansKR;
src: url(../fontawesome-free-6.2.0-web/webfonts/NotoSansKR-Regular.woff) format("woff");
}
* {
margin: 0;
padding: 0;
}
ul {
list-style: none;
}
ul li a {
position: relative;
display: block;
width: 100px;
padding: 15px;
margin: 10px 0;
left: -80px;
border-radius: 0 5px 5px 0;
transition: 0.5s;
color: #202124;
text-decoration: none;
}
ul li a:hover {
left: 0;
}
body {
font: 1em opensans, notosansKR;
color: #202124;
}
#about {
background: #aaa;
}
#blog {
background: #bbb;
}
#project {
background: #ccc;
}
#contact {
background: #ddd;
}
0
- HTML
<input type="radio" name="tab" id="london" checked>
<input type="radio" name="tab" id="paris">
<input type="radio" name="tab" id="tokyo">
<input type="radio" name="tab" id="oslo">
<div id="con1" class="tabcontent">
<h1>London</h1>
<p>London is the capital city of England</p>
</div>
<div id="con2" class="tabcontent">
<h1>Paris</h1>
<p>Paris is the capital city of France</p>
</div>
<div id="con3" class="tabcontent">
<h1>Tokyo</h1>
<p>Tokyo is the capital city of Japan</p>
</div>
<div id="con4" class="tabcontent">
<h1>Oslo</h1>
<p>Oslo is the capital city of Norway</p>
</div>
<label for="london" class="tablink">London</label>
<label for="paris" class="tablink">Paris</label>
<label for="tokyo" class="tablink">Tokyo</label>
<label for="oslo" class="tablink">Oslo</label>
- CSS
@charset "utf-8";
@font-face {
font-family: opensans;
src: url(../fontawesome-free-6.2.0-web/webfonts/OpenSans-Regular.woff) format("woff");
}
@font-face {
font-family: notosansKR;
src: url(../fontawesome-free-6.2.0-web/webfonts/NotoSansKR-Regular.woff) format("woff");
}
* {
padding: 0;
margin: 0;
}
a {
text-decoration: none;
}
body {
font: 1em opensans, notosansKR;
}
input[type=radio] {
display: none;
}
.tabcontent {
display: none;
color: #222222;
padding: 50px;
text-align: center;
}
#con1 {
background: rgb(252, 187, 187);
}
#con2 {
background: rgb(140, 204, 140);
}
#con3 {
background: rgb(145, 205, 237);
}
#con4 {
background: rgb(245, 231, 161);
}
.tablink {
display: block;
width: 25%;
padding: 10px 0;
background: #eee;
float: left;
text-align: center;
cursor: pointer;
}
.tablink:hover {
background: #eee;
}
#london:checked ~ #con1 {
display: block;
}
#paris:checked ~ #con2 {
display: block;
}
#tokyo:checked ~ #con3 {
display: block;
}
#oslo:checked ~ #con4 {
display: block;
}
#london:checked ~ label:first-of-type{
background: rgb(252, 187, 187);
}
#paris:checked ~ label:nth-of-type(2){
background: rgb(140, 204, 140);
}
#tokyo:checked ~ label:nth-of-type(3){
background: rgb(145, 205, 237);
}
#oslo:checked ~ label:last-of-type{
background: rgb(245, 231, 161);
}
0
- HTML
<div class="top-image"></div>
<div class="top-text">
<h1>photo1</h1>
<p>photo1</p>
<button>Read More</button>
</div>
- CSS
@font-face {
font-family: montserrat;
src: url(../fontawesome-free-6.2.0-web/webfonts/Montserrat-SemiBold.woff) format("woff");
}
* {
margin: 0;
padding: 0;
}
html, body {
font-family: montserrat;
height: 100%;
}
.top-image {
position: relative;
background: linear-gradient(rgba(0,0,0,0.2), rgba(0,0,0,0.2)), url(images/photo1.jpg);
background-position: center;
background-size: cover;
height: 100%;
/* filter: blur(5px); */
}
.top-text {
position: absolute;
left: 50%;
top: 50%;
width: 80%;
transform: translate(-50%, -50%);
color: #fff;
text-align: center;
border: 1px solid #f1f1f1;
padding: 50px;
background: rgba(0,0,0,0.5);
box-sizing: border-box;
}
.top-text h1 {
font-size: 50px;
}
.top-text button {
display: inline-block;
width: 100px;
padding: 5px 0;
margin: 10px 0 0;
}
0
반응형