justify-content: space-between; (item 3개)일때 가운데 item을 가운데로 두는법 (css hack)
item의 width를 33%로 만들기
2번째 item
display: flex;
justify-content: center;
3번째 item
display: flex;
justify-content: flex-end;
align-items: center;
input css로 이쁘게 만들기
border: none;
border-bottom: 1px solid 원하는색깔
input focus됐을때 outline 삭제
input:focus {
outline: none;
}
CSS 변수 사용하기
not selector
input:not([type="submit"])
input의 type="submit"이 아닌 input을 가르킴
form method와 action
method는 get 과 post 방식으로 나뉨
get이면 input의 name에 username이라고 설정하고 JaeHun을 입력하면 url에 username=JaeHun 이라고 나타남.
action="url주소" 해당 url주소로 페이지가 이동함.
position: fixed
fixed 프로퍼티 선언 시 주의할 점은, block 요소의 width는 inline 요소와 같이 content에 맞게 변화되므로 적절한 width를 지정하여야 한다.
box-sizing: border-box
width가 200px인 element한테 padding-left를 50px주면 해당 element의 총 size는 250px(200px + 50px)이된다. 이러한 이유로 box-sizing: border-box를 설정하면 해당 element에 설정한 width가 유지된다.
css로 소문자 → 대문자
text-transform: uppercase;
inline/block
flex
border-top-left-radius
animation
@keyframes hideSplashScreen{
from {
opacity: 1;
} to {
opacity: 0;
visibility: hidden;
}
}
animation: hideSplashScreen 0.4s ease-in-out forwards;
animation-delay: 1.5s;
will-change
first-child와 first-type-of
자식요소 중에 가장 첫번째를 선택하는 가상클래스
.message-row:first-child는 적용이안됨
- 자식요소 중에 가장 첫번째를 선택하는데 첫번째 자식이 .chat-timestamp이기 때문
- .chat-timestamp보다 앞에 있으면 쓸 수 있음.
<main class="main-screen main-chat">
<div class="chat-timestamp">Tuesday, Junew 30, 2020</div>
<div class="message-row message-fade-in"></div>
<div class="message-row message-row--own"></div>
</main>
밑의 코드역시 .message-row:first-type-of는 적용이안됨
first-of-type은 같은 요소타입(같은 tag)중에서 첫번째 요소 이며 추가 조건(클래스 명) 등 을 만족한 경우가 적용됨
.chat-timestamp가 같은 요소타입(div)이기 때문에 적용 안됨
적용 될려면 .chat-timestamp을 다른 tag로 쓰면 가능
<main class="main-screen main-chat">
<div class="chat-timestamp">Tuesday, Junew 30, 2020</div>
<div class="message-row message-fade-in"></div>
<div class="message-row message-row--own"></div>
</main>
media query
@media media-type and (media-feature-rule) {
/* CSS rules go here */
}
@media screen and (max-width: 400px) {
body {
color: blue;
}
}
@media screen and (width: 600px) {
body {
color: red;
}
}