inline-stylesbir belgede en yüksek önceliğe sahiptir, bu nedenle örneğin bir divöğenin rengini olarak değiştirmek istiyorsanız blue, ancak inline stylebir colorözelliğe sahipred
<div style="font-size: 18px; color: red;">
Hello World, How Can I Change The Color To Blue?
</div>
div {
color: blue;
}
Öyleyse, jQuery / Javascript Kullanmalı mıyım? - Cevap HAYIR
element-attrCSS Seçiciyi birlikte kullanabiliriz !important, not !importantburada önemlidir, aksi takdirde satır içi stilleri aşmaz ..
<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;
}
Demo
Not: !importantYALNIZCA kullanmak burada işe yarar, ancak div[style]özel olarak divsahip olma style
özelliğini seçmek için seçiciyi kullandım