<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>repl.it</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="container">
<div class="main-logo"><img src="https://user-images.githubusercontent.com/61774575/95163201-34411c00-075c-11eb-9987-d6301acb4dab.png"></div>
<div class="search-bar"><input type="text"></input></div>
<div class="icons">
<img class="first" src="https://www.flaticon.com/svg/vstatic/svg/71/71403.svg?token=exp=1613531088~hmac=076e0ce6c7ceb134a1d36b7c81cd825a">
<img class="second" src="https://cdn.icon-icons.com/icons2/37/PNG/128/keyboard_4316.png">
<img class="third" src="https://cdn.icon-icons.com/icons2/711/PNG/128/microphone-2_icon-icons.com_62161.png">
</div>
<div class="btn-1"><span class="btn1-1">Weegle 검색</span>
<span class="btn1-2">I'm feeling Lucky</span></div>
<div class="footer"><span class="weegle">Weegle 제공 서비스 : </span>
<span class="english">English</span>
</div>
</div>
</body>
</html>
.main-logo {
text-align: center;
}
img {
width: 300px;
}
.search-bar {
text-align: center;
}
.icons {
position: relative;
}
.first {
position: absolute;
width: 16px;
top: -20px;
right: 810px;
}
.second {
position: absolute;
width: 16px;
top: -20px;
right: 460px;
}
.third {
position: absolute;
width: 16px;
top: -20px;
right: 440px;
}
input {
width: 400px;
height: 23px;
border: 1px solid lightgrey;
border-radius: 15px;
}
.btn-1 {
text-align: center;
color: grey;
font-size: 13px;
font-weight: bold;
}
.btn1-1 {
display: inline-block;
margin: 15px;
padding: 10px;
background-color:#f5f5f5;
border-radius: 5px;
margin: 10 auto;
}
.btn1-2 {
display: inline-block;
margin: 15px;
padding: 10px;
background-color:#f5f5f5;
border-radius: 5px;
margin: 0 auto;
}
.footer {
text-align: center;
font-size: 8pt;
}
.weegle {
font-weight: bold;
}
.english {
color: blue;
}
* {
box-sizing: border-box;
}
여기서 문제점은.
와이라노.. 와이라노.. 사이트를 확대/축소 할 경우 아이콘들이 지멋대로 이동한다. 좀 더 찾아보고 해결되면 밑에 바로 포스팅 하겠다...
<body>
<div class="container">
//전체를 감싸주는 div 태그를 일단 씀.
<div class="main-logo">
<img src="https://user-images.githubusercontent.com/61774575/95163201-34411c00-075c-11eb-9987-d6301acb4dab.png"></div>
//메인 로고 또한 div로 감싸줌 그리고 div class를 통하여 이미지의 크기를 조정.
<div class="search-bar">
<input type="text"></input>
<img class="first" src="https://www.flaticon.com/svg/vstatic/svg/71/71403.svg?token=exp=1613531088~hmac=076e0ce6c7ceb134a1d36b7c81cd825a">
<img class="second" src="https://cdn.icon-icons.com/icons2/37/PNG/128/keyboard_4316.png">
<img class="third" src="https://cdn.icon-icons.com/icons2/711/PNG/128/microphone-2_icon-icons.com_62161.png">
</div>
//search-bar 와 그 bar 안에 들어갈 아이콘들을 같은 div로 감싸줌.
각 아이콘들에게도 클래스를 부여함.
각 각의 위치가 달라서 각 각 지정해줘야 하기 때문에.
<div class="btn-1"><span class="btn1-1">Weegle 검색</span>
<span class="btn1-2">I'm feeling Lucky</span></div>
//일단 버튼이 될 두 개를 하나의 div로 감싸주고,
각 버튼마다 클래스를 부여.
span태그를 쓴 이유:
css에서 inline-block 을 통해 가운데에 각각 위치시킬 생각으로 사용.
<div class="footer"><span class="weegle">Weegle 제공 서비스 : </span>
<span class="english">English</span>
</div>
//'Weegle : '제공서비스 : ' 와 그 옆의 'English'의 색상이 다르기 때문에 둘을 나눠서 따로 클래스를 부여.
</div>
</body>
.container {
position: absolute;
}
//페이지 가운데에 정렬하고 싶었는데 그렇게 하면
아이콘들이 자꾸 중구난방으로 돌아댕겨서
그냥 전체에다가 absolute 해버림.
.main-logo {
text-align: center;
}
img {
width: 300px;
}
.search-bar {
position: relative;
text-align: center;
}
//일단 부모 div 클래스에 position: relative;를 지정.
그래야 아래 자식들인 아이콘들에게 absolute를 지정해줬을 때 고정이 되게 해준다.
input {
width: 400px;
height: 23px;
border: 1px solid lightgrey;
border-radius: 15px;
}
//Search bar 스타일 꾸며주기.
.first {
position: absolute;
top: 5px;
width: 16px;
left: 10px;
}
.second {
position: absolute;
top: 5px;
width: 16px;
right: 30px;
}
.third {
position: absolute;
top: 5px;
width: 16px;
right: 10px;
}
//나를 아주 열받게 한 주요인물들. 그래 너희들의 잘못은 아무거또 없단다.
각각에게 absolute를 지정해주고, 바 안에 잘 들어갈 수 있게 위치들과 크기도 지정해주었다.
.btn-1 {
text-align: center;
color: grey;
font-size: 13px;
font-weight: bold;
margin: 0 auto;
}
//버튼을 감싸고 있는 부모 클래스다. 두 버튼에게 공통적으로 적용되는 스타일들을 넣어주었다.
.btn1-1 {
display: inline-block;
margin: 15px;
padding: 10px;
background-color:#f5f5f5;
border-radius: 5px;
}
//첫번째 버튼 스타일 inline인 span을 display: inline-block; 을 통하여 속성을 바꿔줌.
.btn1-2 {
display: inline-block;
margin: 15px;
padding: 10px;
background-color:#f5f5f5;
border-radius: 5px;
}
//두번째 버튼 스타일. inline인 span을 display: inline-block; 을 통하여 속성을 바꿔줌.
.footer {
text-align: center;
font-size: 8pt;
}
.weegle {
font-weight: bold;
}
.english {
color: blue;
}
페이지의 한 가운데에 구현하고 싶었는데 도저히 모르겠다. 어쨌든 아이콘을 감싸는 부모 클래스에 relative를 부여하고 자식 클래스들에게 absolute를 지정해주는 것을 이해해서 다행이라고 생각한다. 일단 다음 과제를 얼른 마치고 따로 좀 더 수련하는 시간을 가져보도록 하겠다.