inline-styles당신이의 색상 변경하려는 경우 문서에 너무 예를 들어 말하자면를 들어, 가장 높은 우선 순위를 가지고 div하는 요소를 blue하지만, 당신은을했습니다 inline style로모그래퍼 color속성 세트red
<div style="font-size: 18px; color: red;">
Hello World, How Can I Change The Color To Blue?
</div>
div {
color: blue;
/* This Won't Work, As Inline Styles Have Color Red And As
Inline Styles Have Highest Priority, We Cannot Over Ride
The Color Using An Element Selector */
}
그렇다면 jQuery / Javascript를 사용해야합니까? -대답은 아니오
우리가 사용할 수 element-attr와 CSS 선택기를 !important참고, !important다른이를 통해 인라인 스타일을 타고하지 않습니다, 여기서 중요한 ..
<div style="font-size: 30px; color: red;">
This is a test to see whether the inline styles can be over ridden with CSS?
</div>
div[style] {
font-size: 12px !important;
color: blue !important;
}
데모
참고 : 사용 !important만 여기에 작동하지만 내가 사용했습니다
div[style]특별히 선택에 선택을 div가진 style
속성을