⏰ 2024.11.26 (D+34)
transform: translateX(50px); /* 오른쪽으로 50px 이동 */
transform: translate(50px, 100px); /* X축 50px, Y축 100px 이동 */
transform: rotate(45deg); /* 45도 회전 */
transform: rotate(-90deg); /* -90도 반시계방향 회전 */*/
transform: scale(2); /* 가로, 세로 2배 확대 */
transform: scale(1.5, 0.5); /* 가로 1.5배 확대, 세로 0.5배 축소 */
transform: skewX(30deg); /* X축 기준으로 30도 기울임 */
transform: skew(30deg, 10deg); /* X축 30도, Y축 10도 기울임 */
transform: matrix(1, 0, 0, 1, 50, 50);
transform: translateX(50px) rotate(30deg) scale(1.2);
transform: rotateX(45deg) translateZ(100px);
transition: transform 2s ease-in-out;
transform: rotate(45deg);
transform: translate(100px, 200px); /* 오른쪽 100px, 아래로 200px 이동 */
transform: rotate(45deg) scale(1.5); /* 45도 회전하고 1.5배 확대 */
button:hover {
transform: scale(1.1); /* 마우스를 올리면 버튼이 커짐 */
}
@keyframes animationName {
0% {
/* 초기 스타일 */
}
50% {
/* 중간 스타일 */
}
100% {
/* 최종 스타일 */
}
}
animation: animationName duration delay timingFunction iterationCount direction playState;
@keyframes example {
0% {
transform: scale(1);
}
100% {
transform: scale(2);
}
}
div {
animation: example 3s infinite;
}
@keyframes colorChange {
0% {
background-color: red;
}
50% {
background-color: yellow;
}
100% {
background-color: green;
}
}
div {
animation: colorChange 4s infinite ease-in-out;
}
div {
animation: move 3s infinite;
}
div:hover {
animation-play-state: paused;
}
@keyframes bounce {
50% {
transform: scale(0.5);
}
100% {
transform: scale(1);
}
}
.item {
animation: bounce 1s infinite;
}
.item:nth-child(2) {
animation-delay: 0.2s;
}
@import url("path_to_css_file.css");
@import url("styles/import.css");
@media media-type (condition) {
/* 조건이 만족될 때 적용될 스타일 */
}
@media screen {
.content {
color: white;
}
}
@media print {
.content {
color: black;
background-color: white;
}
}
<style>
/* 외부 CSS 파일 가져오기 */
@import url(styles/import.css);
/* 기본 스타일 */
.content {
color: yellow;
background-color: black;
}
/* 화면용 스타일 */
@media screen {
.content {
color: white;
}
}
/* 프린터용 스타일 */
@media print {
.content {
color: black;
background-color: white;
}
}
</style>
<div class="content">
<p>
이런 가운데 전세 수요는 폭발하고 있다. 한국감정원의 지난 5일 기준 서울의 전세 수급지수는 121.4로 2016년 1월 이후 가장 높은 수준을 보였다...
</p>
</div>
(1) 화면에서의 스타일링 (screen)
텍스트 색상: 흰색
배경 색상: 검정색
(2) 프린트에서의 스타일링 (print)
텍스트 색상: 검정색
배경 색상: 흰색
(3) 외부 CSS 파일
: 추가적인 스타일이 import.css 파일에서 불러와져 적용
📂 ResponseWeb16.html
(1) @media 쿼리 사용
(2) 기본 스타일링
(3) 자바스크립트 이벤트 처리
window.onresize = function() {
var p = document.querySelector('p');
var style = window.getComputedStyle(p);
console.log('해상도: %s, 폰트 크기:%s', window.innerWidth, style.fontSize);
};