[Day6] CSS 6 [11/17]
--๋ณต์ต--
<style>
.sticky{ // sticky ํด๋์ค ์ ํ์
position: fixed; // ๊ณ ์
top:0; // 0
width: 100%; // ๋ถ๋ชจ 100%
}
</style>
<script>
var navbar = document.getElementById("navbar"); //
// DOM ๋ฉ์๋ getElementById() : ์์ด๋๋ช
์ผ๋ก ์์๋ฅผ ์ป์ด์์ ๋ณ์ ์ ์ฅ
console.log( navbar.offsetTop );
var nbOtop = navbar.offsetTop;
window.onscroll = function (){
if ( window.pageYOffset >= nbOtop ) {
navbar.classList.add("sticky");
} else {
navbar.classList.remove("sticky");
}
};
</script>
* ์คํฌ๋กค ๋ด๋ ค์ sticky
css ํ ์คํธ ํจ๊ณผ
1. ํ ์คํธ ์ค๋ฒํ๋ก( text-overflow )
2. ์๋ ์ค ๋ฐ๊ฟ ( word-wrap )
- ํ๋์ ๋จ์ด๊ฐ ๋๋ฌด ๊ธธ์ด์ ๋๋น ๋ณด๋ค ์ค๋ฒํ๋ก์ ๋ฐ์.
- ๊ฐ์ ์ค ๋ฐ๊ฟ ์์ผ์ผ ๊ฒ ๋ค.
3. ์ค๋ฐ๊ฟ ๊ท์น ( word-break )
<style>
p{
width: 200px;
border: 1px solid black;
}
p.test1{
/* ํ
์คํธ ์ค๋ฒํ๋ก์ */
white-space: nowrap;
overflow: hidden;
text-overflow: clip; /* ํด๋ฆฝ, ์๋ผ๋ด๋ค */
}
p.test2{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis; /* ์๋ตํ๋ค ... */
/* ๊ธด๋ฌธ์์ด.substring(0,25).concat("...") */
}
/* ๋ง์ฐ์ค๋ฅผ ์ฌ๋ฆด๋ ์ค๋ฒํ๋ก๋ ์ฝํ
์ธ ๋ฅผ ํ์ํ๋ ๋ฐฉ๋ฒ */
p.test2:hover{
overflow: visible;
}
</style>
<style>
p.test3{
word-wrap:break-word;
word-break:break-all;
}
</style>
<!-- p.test$*2>lorem10 -->
<p class="test1">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro adipisci!
</p>
<p class="test2">
Dolor asperiores doloribus amet architecto sint et eius provident quisquam!
</p>
<p class="test3">
Dolorum deserunt ducimusquoconsequunturalias esse ex quaerat dignissimos!
</p>
* white-space : nowrap - ์๋ ๊ฐํํ์ง ์๊ณ ์ค๊ธ๋ก ์ซ
* text-overflow : ellipsis - ์ค๋ฒํ๋ก์ฐ ๋ ๋ถ๋ถ ์๋ต๋จ
text-overflow : clip - ์๋ผ๋
4. writing-mode ์ํ/์์ง ํ ์คํธ ๋ฐฐ์น(์ถ๋ ฅ) ์ง์ ์์ฑ
<style>
p.test1{
writing-mode:horizontal-tb; /* ๊ฐ๋ก ์ฐ๊ธฐ ๋ชจ๋ */
}
p.test3{
writing-mode:vertical-rl; /* ์ธ๋ก ์ฐ๊ธฐ ๋ชจ๋ */
}
p.test2 > span{
writing-mode:vertical-rl;
}
</style>
<p class="test1">Lorem ipsum dolor sit amet.</p>
<p class="test2">Sequi <span>laborum</span> reprehenderit ipsum dolorem.</p>
<p class="test3">Repudiandae illo dicta quae ad.</p>
css ์น ๊ธ๊ผด
[ css ์น ๊ธ๊ผด ]
ํด๋ผ์ด์ธํธ์ ์ค์น ๋์ง ์์ ๊ธ๊ผด -> ์น ๊ธ๊ผด
์๋์ผ๋ก ์น ์๋ฒ์์ ๊ธ๊ผด ๋ค์ด๋ก๋ -> ํด๋ผ์ด์ธํธ์์ ๊ธ๊ผด ์ฌ์ฉ.
[๋ค์ํ ๊ธ๊ผด ํ์]
1. ํธ๋ฃจํ์ ๊ธ๊ผด( TTF ) - 1980๋ ๋ ํ๋ฐ Apple/MS ๊ฐ๋ฐํ ํ์ค ๊ธ๊ผด ํ์
2. ์คํํ์ ๊ธ๊ผด( OTF ) - TTF ํ์ ๊ธฐ๋ฐ์ ํ์ฅ ๊ฐ๋ฅํ ๊ธ๊ผด ํ์( MS ๋ฑ๋ก ์ํ )
3. ์น ์คํ ๊ธ๊ผดํ์( WOFF ) - ์น ํ์ด์ง์์ ์ฌ์ฉํ๊ธฐ ์ํ ๊ธ๊ผด ํ์
4. SVG ๊ธ๊ผด
5. ์๋ฒ ๋๋ ์คํ ํ์ ( EOT)
<style>
@font-face{
font-family: myFirstWebFont;
src:url('../images/sansation_bold.woff');
font-weight: bold;
}
*{
font-family: myFirstWebFont;
}
</style>
- ์๋ฒ์์ ๋ฐ์์ ์ฌ์ฉํ๊ฒ ๋ค๋ ๊ฒ
<h1>@font-face ๊ท์น(Rule)</h1>
<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Architecto molestias.</div>
<p><b>Note : </b>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Illo optio dolor a consequatur error eaque laborum in doloribus fugit nesciunt praesentium provident possimus esse laboriosam ducimus dolorum vero saepe libero.</p>
css 2D ๋ณํ (transform)
css 2D ๋ณํ - ์์๋ฅผ ์ด๋, ํ์ , ๋น์จ ์กฐ์ , ๊ธฐ์ธ๊ธฐ.
transform ์์ฑ
1) translate() ์ด๋
2) rotate() ํ์
div{
width: 300px;
height: 100px;
background-color: yellow;
border:1px solid black;
/* 1. ์์ ์ด๋ : transform : translate() ์ํ, ์์ง ์ด๋ */
/*
transform: translate( 50px, 100px );
-ms-transform: translate( 50px, 100px );
*/
/* 2. ์์ ํ์ rotate() ์๊ณ๋ฐฉํฅ + , ๋ฐ์๊ณ๋ฐฉํฅ - ๊ฐ๋ ํ์ */
/* transform:rotate( 20deg ); */
/* transform:rotate( -20deg ); */
}
<input type="radio" name="direction" value="1" checked="checked">์๊ณ๋ฐฉํฅ
<input type="radio" name="direction" value="-1">๋ฐ์๊ณ๋ฐฉํฅ
<br>
<button>ํ์ ์์</button>
<button>ํ์ ๋ฉ์ถค</button>
<p>.</p>
<p>.</p>
<p>.</p>
<div>
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
Saepe fuga sit aut facere doloremque architecto.
</div>
<script>
var angle = 1; // ํ์ ์ํฌ ๊ฐ๋
var direction = 1; // ํ์ ์ํฌ ๋ฐฉํฅ 1(์๊ณ) -1(๋ฐ์๊ณ)
var timer;
// [ ํ์ ์์ ๋ฒํผ ]
// 1๋ฒ ํด๋ฆญ
document.querySelector("button:first-of-type").onclick = function (){
//alert("first");
// [ ์ฒดํฌ๋ ๋ผ๋์ค ๋ฒํผ์ value ์์ฑ ]
// direction = ๋ผ๋์ค๋ฒํผ ์, ๋ฐ์;
// 1. ๋ชจ๋ ๋ผ๋์ค ๋ฒํผ
// document.getElementsByTagName("input")
// var radios = document.getElementsByName("direction");
var radios = document.querySelectorAll("input[name=direction]");
// alert( radios.length );
for (var i = 0; i < radios.length; i++) {
//console.log( radios[i].checked +"/" + radios[i].value );
if( radios[i].checked == true){
direction = radios[i].value;
} // if
} //
// ํจ์ ๋ฑ๋ก
timer = setInterval( div_rotate , 10)
this.disabled = "true"; // ๋นํ์ฑํ
document.querySelector("button:last-of-type").disabled = false;
}
document.querySelector("button:last-of-type").onclick = function (){
//alert("last");
clearInterval(timer);
this.disabled = "true"; // ๋นํ์ฑํ
document.querySelector("button:first-of-type").disabled = false;
}
function div_rotate(){
var target = document.querySelector("div");
// css transform:rotate( 20deg ); -> js
target.style.transform = "rotate( " + angle + "deg )";
// js "1" -> 1 ๋ณํ
// java Integer.parseInt()
angle += parseInt( direction ); // js += ๋ณตํฉ๋์
์ฐ์ฐ์.
console.log( "> angle = " + angle );
}
</script>
3) scaleX() / scaleY() / scale() ๋น์จ ์กฐ์
4) skewX() / skewY() / skew() ๊ธฐ์ธ๊ธฐ
5) matrix() ์ฝ์
<style>
div{
width: 300px;
height: 100px;
background-color: yellow;
border:1px solid black;
/* 1 2 0.5 ๋ฐฐ */
/*
transform:scaleX(1.5);
transform:scaleY(1.5);
*/
/*
transform:scale( 2 , 0.5 );
*/
/* ์ง์ ๋ ๊ฐ๋๋งํผ X ์ถ์ ๋ฐ๋ผ ์์๋ฅผ ๊ธฐ์ธ์ธ๋ค. */
/* transform:skewX( 30deg ); */
/* transform:skewX( 90deg ); */
/* transform:skewY( 40deg ); */
/* transform:skew( 20deg , 10deg); */
/* transform:skew( 20deg ); == skew( 20deg, 0) */
/* matrix == ํ๋ ฌ , ๋ง , 2D(์ด๋,ํ์ X,๋น์จ์กฐ์ ,๊ธฐ์ธ๊ธฐ) + ๊ฒฐํฉ*/
/* ํ์ X */
/* transform:matrix(scaleX, skewY, skewX, scaleY, tranlateX, translateY) */
transform:matrix(1, -0.3, 0, 1, 0, 0);
}
</style>
3D ๋ณํ( x,y,z )
1. ์์ ์ด๋
transform:translateX(),
transform:translateY(),
transform:translateZ(),
transform:translate3d(x,y,z)
2. ์์ ํ์
transform:rotateX()
transform:rotateY()
transform:rotateZ()
transform:rotate3d()
3. ์์ ๋น์จ ์กฐ์
transform:scaleX()
transform:scaleY()
transform:scaleZ()
transform:scale3d()
4. ์์ ๊ธฐ์ธ๊ธฐ X
5. transform:matrix3d(,,,,,,,);
<script>
var angle = 1; // ํ์ ์ํฌ ๊ฐ๋
var timer;
document.querySelector("button:first-of-type").onclick = function (){
timer = setInterval(function() {
var target = document.getElementById("demo");
// transform:translateX(),
/* target.style.transform = "rotateX("+ angle +"deg)"; */
/* target.style.transform = "rotateY("+ angle +"deg)"; */
target.style.transform = "rotateZ("+ angle +"deg)";
angle++; // js ++,-- ์ฆ๊ฐ์ฐ์ฐ์.
}, 10);
}
</script>
2D 3D ๋น๊ต
<style>
#rotate2D, #rotate3D{
width:80px;
height:70px;
color:white;
position:relative;
font-weight: bold;
font-size: 15px;
padding: 10px;
float: left;
margin-right:50px;
border-radius: 5px;
border:1px solid #000;
background-color: red;
margin:10px;
}
</style>
<div style="height: 80px;">
<div id="rotate2D" onmouseover="rotateDiv1();">2D rotate</div>
<div id="rotate3D" onmouseover="rotateDiv2();">3D rotate</div>
</div>
<script>
var div2D; // div id="rotate2D"
var div3D; // div id="rotate3D"
var timer2D;
var timer3D;
var angle2D = 0;
var angle3D = 0;
function rotateDiv1(){
// 2D ํ์
div2D = document.getElementById("rotate2D");
clearInterval(timer2D);
timer2D = setInterval(function() {
angle2D++;
div2D.style.transform = "rotate("+ angle2D+"deg)";
div2D.style.webkitTransform = "rotate("+ angle2D+"deg)";
div2D.style.OTransform = "rotate("+ angle2D+"deg)";
div2D.style.MozTransform = "rotate("+ angle2D+"deg)";
if( angle2D == 180 || angle2D == 360 ){
clearInterval(timer2D);
if( angle2D == 360)
angle2D = 0;
}
}, 10);
}
function rotateDiv2(){
div3D = document.getElementById("rotate3D");
clearInterval(timer3D);
timer3D = setInterval(function() {
angle3D++;
div3D.style.transform = "rotateY("+ angle3D+"deg)";
div3D.style.webkitTransform = "rotateY("+ angle3D+"deg)";
div3D.style.OTransform = "rotateY("+ angle3D+"deg)";
div3D.style.MozTransform = "rotateY("+ angle3D+"deg)";
if( angle3D == 180 || angle3D == 360 ){
clearInterval(timer3D);
if( angle3D == 360)
angle3D = 0;
}
}, 10);
}
</script>
[ ์ ํ( transition) ]
1) ์ง์ ๋ ๊ธฐ๊ฐ๋์ ์์ฑ ๊ฐ์ ์ํ ํ๊ฒ ๋ณ๊ฒฝํ๋ ๊ฒ.
width:0px; -> :hover -> width:180px
์) transition: 0.5s ease;
์) transition: width 0.5s ease;
2) transition ์ฝ์
- transition-delay ์์ฑ X
- transition-duration ์์ฑ : 0.5s
- transition-property ์์ฑ : width
- transition-time-function ์์ฑ : ease
3) ์ ํ ํจ๊ณผ๋ฅผ ๋ง๋ค๋ ค๋ฉด 2๊ฐ์ง ์ค์ .
(1) ํจ๊ณผ๋ฅผ ์ถ๊ฐํ๋ ค๋ css ์์ฑ
(2) ํจ๊ณผ๋ฅผ ์ง์ ์๊ฐ
( ์ง์ ์๊ฐ์ ์ง์ ํ์ง ์์ผ๋ฉด ๊ธฐ๋ณธ๊ฐ์ 0 ์ผ๋ก ์ ์ฉ๋๋ค. )
<style>
div{
background: red;
width:100px;
height:100px;
/* ease ํจ๊ณผ: ์์(์ฒ์ฒํ) -> ๋นจ๋ผ์ง๊ณ -> ์ข
๋ฃ( ์ฒ์ฒํ) */
/* transition:width 2s ease, height 2s ease-in; */
/* transition: 2s ease; */
/* ์ ํ ์ง์ฐ ์๊ฐ */
transition-delay:1s;
transition-property:width; /* ์ ํ์์ฑ */
transition-duration: 2s; /* ์ ํ๊ธฐ๊ฐ */
transition-timing-function:ease; /* ์ ํ์๋๊ณก์ */
}
div:hover{
width: 300px;
height:200px;
}
</style>
์ ํ ์๋ ๊ณก์ : ease ํจ๊ณผ
1. ease : ์ฒ->๋นจ->์ฒ ( ๊ธฐ๋ณธ๊ฐ)
2. linear: ๋ฑ์
3. ease-in : ๋๋ฆฐ ์์์ผ๋ก ~
4. ease-out : ๋๋ฆฐ ์ข
๋ฃ..
5. ease-in-out : ์ฒ ์์~ ์ฒ ์ข
๋ฃ
div:nth-of-type(1){ transition-timing-function:ease; }
div:nth-of-type(2){ transition-timing-function:linear; }
div:nth-of-type(3){ transition-timing-function:ease-in; }
div:nth-of-type(4){ transition-timing-function:ease-out; }
div:nth-of-type(5){ transition-timing-function:ease-in-out; }
[ ๋ณํ( transform) - ์ด๋, ํ์ , ํฌ๊ธฐ ๋น์จ์กฐ์ , ๊ธฐ์ธ๊ธฐ ]
๋ณํ(transform) + ์ ํ(transition)
div{
width: 100px;
height: 100px;
background-color: red;
transition:width 2s ease, height 2s ease, transform 2s;
display: inline-block;
}
div:hover{
width: 300px;
height: 300px;
/* ๋ณํ - ์ด๋, ํ์ , ํฌ๊ธฐ ์กฐ์ , ๊ธฐ์ธ๊ธฐ ( transform์์ฑ )*/
transform:rotate(180deg);
}
css ์ ๋๋ฉ์ด์
- js ๋๋ Flash๋ฅผ ์ฌ์ฉํ์ง ์๊ณ , html ์์์ ์ ๋๋ฉ์ด์ ์ ์ฒ๋ฆฌ.
- ์ ๋๋ฉ์ด์ ? ํ ์คํ์ผ์์ ๋ค๋ฅธ ์คํ์ผ๋ก ์ ์ฐจ์ ์ผ๋ก ๋ณํ๋๋ ๊ฒ.
- css ์์ฑ
@keyframes
animation-name
animation-duration
animation-iteration-count
animation-direction
animation-timing-function
animation-fill-mode
animation ์ฝ์ ์์ฑ.
keyframe(ํค ํ๋ ์) ? ํน์ ์๊ฐ์ ๊ฐ์ง๋ ์์์ ์คํ์ผ
keyframe(ํค ํ๋ ์) + ..... ์ฌ๋ฌ ๊ฐ ์ ์ธ...
<style>
div{
width: 100px;
height:100px;
background: red;
animation-name:sample;
animation-duration:4s; /* ์ ๋๋ฉ์ด์
์ ์๋ฃํ๋ ๋ฐ ๊ฑธ๋ฆฌ๋ ์๊ฐ ์ค์ */
animation-timing-function:linear;
/*
์ ๋๋ฉ์ด์
์ด ์ฌ์๋์ง ์์ ๋ ( ์์์ , ์ข
๋ฃํ) ์์์ ์คํ์ผ ์ง์
: forwards - ๋ง์ง๋ง ํคํ๋ ์์ ์คํ์ผ ์ ์ง
, backwards - ์ฒซ ๋ฒ์งธ ํคํ๋ ์์ ์คํ์ผ ์ ์ง
, both, none
*/
animation-fill-mode: backwards;
/* animation-delay:2s; */ /* ์ ๋๋ฉ์ด์
2์ด ํ์ ์ฌ์ */
/* animation-delay:-2s; */ /* ์ ๋๋ฉ์ด์
์ด๋ฏธ 2์ด ์ฌ์๋ ํ~ ์์ */
/* animation-iteration-count:3; */ /* ์ ๋๋ฉ์ด์
๋ฐ๋ณต ํ์ */
animation-iteration-count: infinite; /* ๋ฌดํ ๋ฐ๋ณต */
/*
์ ๋๋ฉ์ด์
๋ฐฉํฅ
: normal ( ๊ธฐ๋ณธ๊ฐ)
: reverse( ์ญ๋ฐฉํฅ)
:alternate( ์->๋ค-> ์)
:alternate-reverse
*/
/* animation-direction: reverse; */
animation-direction: alternate;
/* div ์์๋ฅผ ์ด๋ - left, top */
position: relative;
}
@keyframes sample {
/*
from {background-color: red }
to {background-color: yellow }
*/
0% {background-color: red; left:0 ; top:0; }
25% {background-color: green; left:200px ; top:0; }
50% {background-color: blue; left:200px ; top:200px; }
75% {background-color: yellow; left:0 ; top:200px; }
100% {background-color: red; left:0 ; top:0;}
}
</style>
์ข ๋ ์ฝ๊ฒ ์์ฑ๊ฐ์ผ๋ก ํํ
div{
width: 100px;
height:100px;
background: red;
/* 6 ๊ฐ์ ์์ฑ */
/* name , duration, timing function, delay, iteration-count, direction */
animation:sample 4s linear 2s infinite alternate;
/* div ์์๋ฅผ ์ด๋ - left, top */
position: relative;
}
@keyframes sample {
0% {background-color: red; left:0 ; top:0; }
25% {background-color: green; left:200px ; top:0; }
50% {background-color: blue; left:200px ; top:200px; }
75% {background-color: yellow; left:0 ; top:200px; }
100% {background-color: red; left:0 ; top:0;}
}
๋ก๋ฉ & ํ๋ค๊ธฐ
<style>
.loader{
width: 120px;
height:120px;
border:16px solid #f3f3f3;
border-top-color: red;
border-radius: 50%;
animation:spin 1.5s linear infinite;
}
@keyframes spin{
from{ transform:rotate(0deg); }
to { transform:rotate(360deg); }
}
</style>
<style>
img{
width:150px;
border: 1px solid #ddd;
padding:5px;
border-radius: 4px;
}
img:hover{
box-shadow: 0 0 2px 1px rgba(0, 240, 186, 0.5);
/* css ์ ๋๋ฉ์ด์
์ฒ๋ฆฌ : ์ด๋ฏธ์ง(์ฐฝ) ํ๋ค๊ธฐ */
animation:shake 0.5s infinite;
}
@keyframes shake{
0% { transform:translate(1px, 1px) rotate(0deg); }
10% { transform:translate(-1px, -1px) rotate(-1deg); }
20% { transform:translate(3px, 0px) rotate(1deg); }
30% { transform:translate(3px, 2px) rotate(0deg); }
40% { transform:translate(1px, -1px) rotate(1deg); }
50% { transform:translate(-1px, 1px) rotate(-1deg); }
60% { transform:translate(2px, -1px) rotate(0deg); }
70% { transform:translate(-1px, 1px) rotate(1deg); }
80% { transform:translate(3px, -1px) rotate(-1deg); }
90% { transform:translate(1px, 3px) rotate(0deg); }
100% { transform:translate(1px, -2px) rotate(-1deg); }
}
</style>
css ํดํ(tooltip)
[css ํดํ(tooltip)]
์์ ์์ ๋ง์ฐ์ค ํฌ์ธํฐ๋ฅผ ์ด๋ํ ๋
๊ทธ ์์์ ์ถ๊ฐ ์ ๋ณด๋ฅผ ํ์ ๋์๋ง๋ก ๋ํ๋ด๋ ๊ฒ.
== ๋๋กญ๋ค์ด ๋ฉ๋ด
<style>
body{
text-align: center;
}
.tooltip{
position: relative;
border-bottom: 1px dotted black;
display: inline-block;
}
.tooltip .tooltiptext{
position: absolute;
z-index:1;
left:50%;
/* top:100%; */
bottom:130%;
/* ๋ณํ(transform) - ์ด๋, ํ์ , ํฌ๊ธฐ๋น์จ์กฐ์ , ๊ธฐ์ธ๊ธฐ */
transform:translateX(-50%);
background-color: black;
color:white;
width: 120px;
text-align: center;
border-radius: 6px;
padding: 5px 0;
visibility: hidden;
}
.tooltip .tooltiptext::after{
content:"";
border-style: solid;
border-width: 5px;
border-color:black transparent transparent transparent;
position:absolute;
top:100%;
left:50%;
transform:translateX(-50%);
}
.tooltip:hover .tooltiptext{
visibility: visible;
}
</style>
- after ๋ถ๋ถ์ด ํดํ ๋พฐ์กฑ
<!-- p*5>{.} -->
<p>.</p>
<p>.</p>
<p>.</p>
<p>.</p>
<p>.</p>
<!-- .tooltip>span.tooltiptext -->
<div class="tooltip">Hover over me
<span class="tooltiptext">Tooltip Text Sample</span>
</div>
ex2) ํดํ ๋พฐ์กฑ ๋ง๋ค๊ธฐ
<style>
div{
box-sizing: border-box;
width: 40px;
height: 40px;
/*
border-top: 20px solid red;
border-right: 20px solid green;
border-bottom: 20px solid blue;
border-left: 20px solid yellow;
*/
border-style:solid;
border-width:20px;
/* transparent == ํฌ๋ช
ํ */
border-color: red transparent transparent transparent;
}
</style>
ex3 ์์น์กฐ์ )
<style>
body{
text-align: center;
}
.tooltip{
position: relative;
border-bottom: 1px dotted black;
display: inline-block;
}
.tooltip .tooltiptext{
position: absolute;
z-index:1;
left:110%;
top: -50%;
background-color: black;
color:white;
width: 120px;
text-align: center;
border-radius: 6px;
padding: 5px 0;
/* visibility: hidden; */
}
.tooltip .tooltiptext::after{
content:"";
border-style: solid;
border-width: 5px;
border-color: transparent black transparent transparent;
position:absolute;
right: 100%;
top:50%;
transform:translateY(-50%);
}
.tooltip:hover .tooltiptext{
visibility: visible;
}
</style>
๋ทฐํฌํธ(viewport), ๋ฏธ๋์ด ์ฟผ๋ฆฌ
[๋ทฐํฌํธ(viewport)]
1. ์น ํ์ด์ง์์ ์ฌ์ฉ์๊ฐ ๋ณผ ์ ์๋ ์์ญ
2. ํ์ ์์ญ์ ๋๋ฐ์ด์ค(์ฅ์น)์ ๋ฐ๋ผ ํ๋ฉด์ ํฌ๊ธฐ๊ฐ ๋ค๋ฅด๋ค.
3. ์ค๋งํธํฐ, ํ ๋ธ๋ฆฟ, ์ปดํจํฐ ํ๋ฉด - ๋ทฐํฌํธ X
4. ์ฌ๋ฌ ์ฅ์น์์ ๋ธ๋ผ์ฐ์ ๋ฅผ ์ฌ์ฉํด์ ์น ํ์ด์ง๋ฅผ ์ฅ์นํ๋ฉด์ ๋ง๊ฒ ์ถ์, ํ๋..
5. ์ฅ์น์ ํฌ๊ธฐ ๋ฐฐ์จ์ ๋ง๊ฒ ์นํ์ด์ง์ ํฌ๊ธฐ ์ ์ด...
๋ทฐํฌํธ ์ค์ .
<meta name="viewport" content="width=device-width, initial-scale=1.0">
- width=device-width ์ฅ์น์ ํ๋ฉด ๋๋น๋ฅผ ๋ฐ๋ผ์ ์น ํ์ด์ง ๋๋น ์ค์ .
- initial-scale=1.0 ๋ธ๋ผ์ฐ์ ์์ ํ์ด์ง๋ฅผ ์ฒ์ ๋ก๋ํ ๋์ ์ด๊ธฐ ํ๋/์ถ์ ์์ค ์ค์
[๋ฏธ๋์ด ์ฟผ๋ฆฌ]
1. css2 ์ ๋์ @media๊ท์น
2. ๋ค์ํ ๋ฏธ๋์ด ์ ํ์ ๋ฐ๋ผ ์๋ก ๋ค๋ฅธ ์คํ์ผ ์ ์ฉ ์ ์
๋ค์ํ ๋ฏธ๋์ด ์ ํ ? ์ปดํจํฐ ํ๋ฉด์ฉ, ํ๋ฆฐํฐ ์ฉ, ํด๋ํฐ, ํ ๋ ๋น์ ผ ๋ฑ๋ฑ
3. css3 = css2 ๋ฏธ๋์ด ์ ํ + ํ์ฅ
4. ๋ฏธ๋์ด ์ฟผ๋ฆฌ๋ [๋ฌด์ธ๊ฐ๋ฅผ ํ์ธ] ํ ์ฌ์ฉํ ์ ์๋ค.
1) ๋ทฐํฌํธ์ ๋๋น, ๋์ด
2) ์ฅ์น์ ๋๋น, ๋์ด
3) ๋ฐฉํฅ( ํ ๋ธ๋ฆฟ, ํด๋๋ ธ์ ๊ฐ๋ก ๋๋ ์ธ๋ก ๋ชจ๋)
4) ๋ฑ๋ฑ
5. ๋ฏธ๋์ด ์ฟผ๋ฆฌ๋ฅผ ์ฌ์ฉํด์ ๋ฐ์ํ ์น ๊ตฌํ...
6. ๋ฏธ๋์ด ์ฟผ๋ฆฌ ๊ตฌ๋ฌธ ํ์ ์ฒซ๋ฒ์งธ
@media not|only ๋ฏธ๋์ด์ฅ์น์ ํ and ( true/false ํํ์){
css ์ฝ๋ฉ;
}
์) @media only screen and ( max-width:700px ){
css ์ฝ๋ฉ
}
@media ( max-width:700px ){
css ์ฝ๋ฉ
}
ใฑ. ๋ฏธ๋์ด์ฅ์น์ ํ : screen, print, speech ๋ฑ๋ฑ
6. ๋ฏธ๋์ด ์ฟผ๋ฆฌ ๊ตฌ๋ฌธ ํ์ ๋ ๋ฒ์งธ
<link red="stylesheet" href="screen.css" media="not|only ๋ฏธ๋์ด์ฅ์น์ ํ and ( true/false ํํ์" >
์ต๊ทผ๋๊ธ