Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- JSON
- db.json
- couchcoding
- 블럭요소
- useParams
- 카우치코딩
- 6주포트폴리오
- toString
- react
- Redux
- React onClick
- 자바스크립트
- Redux store
- javascript코딩테스트
- 자바스크립트배포
- useSearchParams
- sort
- react redux
- React state
- useEffect
- 협업프로젝트
- line-through
- JavaScript
- first-child
- redux toolkit
- 인라인블럭
- 콜백함수
- redux 사용방법
- foreach
- javascript React
Archives
- Today
- Total
개발하는 루루언니
CSS : nth-child 사용해보기 쉬움 본문
728x90
반응형
<div class="box">
<div></div>
<div></div>
<div></div>
<div></div>
</div>
박스에도 순서가 있다. 맨앞에 1 번 그다음부터 2.3.4 이렇게
.box {
border: 5px solid #000;
text-align: center;
}
.box div {
border: 2px solid black;
margin:10px;
width:200px;
height: 200px;
display: inline-block;
}
.box div:nth-child(1){
background-color: blue;
}
.box div:nth-child(2){
background-color: red;
}
.box div:nth-child(3){
background-color: white;
}
.box div:nth-child(4){
background-color: gold;
}
이름이 없는 순서의 자식요소에 순서를 정해준다 이런 뜻.
.box div : nth-child(순서) {
실행할 내용
}
이렇게 지정해 주면사용이 가능하다.
728x90
'컴퓨터 정보 > html.css.js 기초' 카테고리의 다른 글
제이쿼리 링크하기 (0) | 2022.11.29 |
---|---|
CSS : first-child / last-child 사용해보기 (0) | 2022.11.29 |
CSS: hover 와 transition 사용해보기 (0) | 2022.11.29 |
CSS : relatvie 와 absolute을 써서 박스 밖에 주고 싶다면? (0) | 2022.11.29 |
CSS : 정중앙으로 오게 하고 싶을때 relative와 absolute 그리고 transform (0) | 2022.11.29 |