π€ μ μ
β μ¬μ©νλ μ΄μ
π§ μ€μ
<meta name="viewport" content="width=device-width, initial-scale=1.0">
meta tag λ₯Ό ν΅ν΄ λΈλΌμ°μ μ₯ page μ μΉμμ λΉμ¨μ μ΄λ»κ² μ‘°μ ν κ±΄μ§ μ λ¬ν¨
width=device-width
page λ₯Ό λλ°μ΄μ€ νλ©΄ ν¬κΈ°μ λ§μΆ€
initial-scale=1.0
μ΄κΈ° zoom μ 1.0 μΌλ‘ μ€μ
π€ μ μ
ex>
@media only screen and (max-width: 600px) {
body {
background-color: lightblue;
}
}
=> νλ©΄ λλΉκ° 600px μ΄κ±°λ μμ λ body μ λ³κ²½
β μ¬μ©νλμ΄μ
π± μμ£Όμ¬μ©λλ Breakpoints
/* Extra small devices (phones, 600px and down) */
@media only screen and (max-width: 600px) {...}
/* Small devices (portrait tablets and large phones, 600px and up) */
@media only screen and (min-width: 600px) {...}
/* Medium devices (landscape tablets, 768px and up) */
@media only screen and (min-width: 768px) {...}
/* Large devices (laptops/desktops, 992px and up) */
@media only screen and (min-width: 992px) {...}
/* Extra large devices (large laptops and desktops, 1200px and up) */
@media only screen and (min-width: 1200px) {...}
pc, λͺ¨λ°μΌ λκ°λ‘λ§ λΆλ₯νλ€λ©΄ 768px λ₯Ό Breakpoints λ‘ μ§μ νλ©΄ λ λ―
πΌοΈ Using The width Property
img {
max-width: 100%;
height: auto;
}
If the max-width property is set to 100%, the image will scale down if it has to, but never scale up to be larger than its original size:
max-width λ₯Ό 100% λ‘ μ€μ νλ©΄ νλ©΄μ΄ μμμ Έ width λ‘ μ€μ ν ν¬κΈ°λ³΄λ€ μμμ ΈμΌ νλ©΄ ν¬κΈ°κ° μ€μ΄λ λ€.
μ°Έκ³