/* .container 내에 .active 요소가 있으면 .container에 스타일 적용 */
.container:has(.active) {
border: 2px solid green;
}
/* .card 내에 .button 요소가 있을 때 텍스트 색상 변경 */
.card:has(.button) {
color: blue;
}
/* h1의 바로 다음(같은 레벨)에 p 가 있으면, 아래 조건을 h1에 적용 */
h1:has(+ p) {
margin-bottom: 0;
}
/* .banner안의 .product에 마우스가 올라가면, .rock 내부의 첫번째 img 에 아래 사항을 적용 */
/* 왼쪽 x 축으로 50%, y축 아래쪽으로 50px 이동 */
.banner:has(.product:hover) .rock img:nth-child(1){
transform: translateX(-50%) translateY(50px);
}
/* h1, h2, h3 중 하나일 경우 폰트 크기 설정 */
:is(h1, h2, h3) {
font-size: 2em;
}
/* 버튼이나 링크 중 하나일 경우 배경색 설정 */
button:is(.primary, .secondary), a:is(.primary, .secondary) {
background-color: lightblue;
}
/* 모든 p 요소 중 .intro 클래스를 가지지 않은 요소에 스타일 적용 */
p:not(.intro) {
color: gray;
}
/* 모든 a 요소 중 .external 클래스가 아닌 요소에만 밑줄 추가 */
a:not(.external) {
text-decoration: underline;
}
HTMLCollection, NodeList 비교 (2) | 2024.11.05 |
---|---|
clientX, layerX, offsetX, pageX, x - 마우스 이벤트 객체의 좌표 속성 (1) | 2024.10.30 |
var() 함수, css 변수 설정 (1) | 2024.10.30 |
mousemove , pointmove 차이점 (0) | 2024.10.28 |
getBoundingClientRect() (0) | 2024.10.27 |