programmer-seva.tistory.com/61
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8">
<script src="js/jquery.js"></script>
</head>
<body>
<div style="background:blue; text-align:center; width:300px; height:300px; font-size: 30px; font-weight: bold; line-height: 300px;">
안녕하세요
</div>
<script>
// inline 속성으로 적용된 css 프로퍼티 개별삭제
$("div").css("background-color","");
$("div").css("font-weight","");
$("div").css("text-align","");
// inline 속성으로 적용된 style 전체삭제
// $( 'div' ).removeAttr( 'style' );
//순수 자바스크립트의 removeProperty메서드로 css 개별삭제
// var div = $('div').get(0);
// div.style.removeProperty('text-align');
// div.style.removeProperty('line-height');
</script>
</body>
</html>
출처: https://mylife365.tistory.com/110 [변화에 적응하기]
'HTML 태그 & CSS 속성' 카테고리의 다른 글
모바일에서 1px가량 여백이 생기는 버그 (0) | 2021.12.13 |
---|---|
jQuery ready와 load의 차이 (0) | 2021.04.19 |
[meta 메타태그] 모바일 기기에서 화면이 확대/축소되지 않도록 설정하기 (0) | 2021.01.28 |
nth-child( ) (0) | 2020.12.15 |
CSS의 신기한 선택자 모음들 (0) | 2020.12.07 |
댓글