선택한 요소에 어떠한 행동과 규칙에 의해서 디자인이 적용 되는거
:
사용:link``:active``:hover
:link
사용a:link { color: red;}
:active
a:active { color: blue;}
:hover
a:hover { color: pink;}
:focus
:focus
input:focus{ border: solid 10px red;}
:child
:first-child
,첫번째꺼만 색변경li:first-child{ color: red;}
:last-child
li:last-child{ color: blue;}
:nth-child(#)
#에는 숫자부여li:nth-child(2){ color: gray;}
:nth-child(2n+1)
:nth-child(2n)
:before
,:after
:before
랑 :after
는 글자를 중심으로말그대로 앞뒤에 붙음li:before{ content: "***";}
li:after{ content: "---";}
/
<link rel="stylesheet" type="text/css" href="css/style.css">
/
폴더한개드갈때../
div{ width: 300px; height: 300px; background-image: url(../img/icon.png);}
../
폴더한개를 나온단의미 여기서 기준은 css파일html
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="css/style.css"> </head> <body> <ul class="friends-lists"> <li class="friends-list"> <a href="#"> <img src="https://via.placeholder.com/50" class="friend-thumnail"> <div class="friend-info"> <h3 class="friend-name">김민호</h3> <span class="friend-intro">Minho Kim</span> </div> </a> </li> <li class="friends-list"> <a href="#"> <img src="https://via.placeholder.com/50" class="friend-thumnail"> <div class="friend-info"> <h3 class="friend-name">박지영</h3> <span class="friend-intro">다정한 사람</span> </div> </a> </li> <li class="friends-list"> <a href="#"> <img src="https://via.placeholder.com/50" class="friend-thumnail"> <div class="friend-info"> <h3 class="friend-name">한성은</h3> <span class="friend-intro">헤헷</span> </div> </a> </li> </ul> </body> </html>
CSS
.friends-lists{ list-style: none;} .friends-lists .friends-list a { color: #000000; text-decoration: none;} .friends-lists .friends-list a .friend-thumnail { border: solid 2px gray; border-radius: 20px;} .friends-lists .friends-list a .friend-info .friend-name{ font-size: 20px; color: #000000;} .friends-lists .friends-list a .friend-info .friend-intro{ font-size: 15px; color: #c8c8c8;} /* Custom */ .friends-lists .friends-list a .friend-info .friend-name{ font-size: 50px; color: red;}
html
<ul class="living-lists"> <li class="living-item"> <a href="#"> <img src="https://via.placeholder.com/170x114" class="living-thumnail"> <div class="living-info"> <span class="type">리빙</span> <h3 class="title">유리병에 남은 끈적이 세척하는 법</h3> <p class="paragraph">Nice to meet you Nice to meet you Nice to meet you Nice to meet you Nice to meet you Nice to meet you Nice to meet you Nice to meet you Nice to meet you Nice to meet you</p> <div class="date-wrap"> <span class="source">톡톡밍차</span> <span class="date">2개월 전</span> </div> </div> </a> </li> <li class="living-item"> <a href="#"> <img src="https://via.placeholder.com/170x114" class="living-thumnail"> <div class="living-info"> <span class="type">리빙</span> <h3 class="title">파리 벼룩시장에서 사 온 소품들</h3> <p class="paragraph">Nice to meet you Nice to meet you Nice to meet you Nice to meet you Nice to meet you Nice to meet you Nice to meet you Nice to meet you Nice to meet you Nice to meet you</p> <div class="date-wrap"> <span class="source">주부하루</span> <span class="date">3주일 </span> </div> </div> </a> </li> </ul>
CSS
.living-lists{ list-style: none;} .living-lists .living-item a { color: #000000; text-decoration: none;} .living-lists .living-item .living-info .type { color: #c08d31; font-weight: 700; font-size: 12px;} .living-lists .living-item .living-info .title { color: #000000; font-size: 13px; font-weight: bold;} .living-lists .living-item .living-info .paragraph { font-size: 13px; color: #404040; line-height: 20px;} .living-lists .living-item .living-info .date-wrap .source,.living-lists .living-item .living-info .date-wrap .date{ font-size: 12px; color: #505050;} .living-lists .living-item .living-info .date-wrap .date{ color: gray;} .living-lists .living-item .living-info .date-wrap .date:before{ content: '-';} .living-lists .living-item:hover{ background-color: pink;} .living-lists .living-item a:hover .living-info .title{ text-decoration: underline;}