기초공사 (html,css,javascript)

css스타일 변경하기 본문

jquery

css스타일 변경하기

에스프레소라떼 2023. 1. 25. 20:40

 

/* 연습
$(document).reday(function(){
$('h1').css({'color' : 'red'});
});

_ css에서는 이렇게 표현됨 -css로 풀어쓰고 재해석
1. h1{color:red;}
2. 언더라인 생기게
#typo .inner{text-decoration:underline;}
3. 아래쪽 5px 두께 red
css에서는 
#typo .inner{border-bottom:5px solid red;}쓴다.

4. 돌려라
#typo .inner{transform: rotate(45deg);}

5. 글씨의 투명돌르 50%
#typo .inner{opacity:0.5;}
*/

 

_ jquery로 재해석

$(function(){
$('h1').css('color','red'); //css속성 하나를 변경
/*
$('#typo .inner').css('text-decoration','underline');

$('#typo .inner').css('border-bottom' , '5px solid red');

$('#typo .inner').css('transform', 'rotate(45deg)');

$('#typo .inner').css('opacity', 0.5);
*/

/*
$('#typo .inner').css({
'text-decoration' : 'underline',
'border-bottom' : '5px solid red',
'transform' :  'rotate(45deg)',
'opacity' : '0.5'
});  아래처럼 줄일 수 있다. 언더바랑 따옴표삭제한다.
*/
$('#typo .inner').css({
textDecoration : 'underline',
borderBottom : '5px solid red',
transform :  'rotate(45deg)',
opacity : '0.5'
});


});

 

jquery소스받기

https://releases.jquery.com/

 

'jquery' 카테고리의 다른 글

6_image클릭시 each반복문 / for반복문  (0) 2023.01.30
animate_find / filter  (0) 2023.01.29
04_animate  (0) 2023.01.29
실행지점 제어_event종류  (1) 2023.01.25
1강 jquery / javascript 소스 쓰는 순서  (0) 2023.01.25