0

I would like to change the css but I can't override the defaults. My page code is `

<h1 class="page_title">Today's Top Ten Videos</h1>              
<div id="main_inner">
<div class="top-layout"><div class="top-layout-row">
<div class="top-layout-cell"><h4 class="top-video-title">
 <a href="http://xxx">Title</a></h4>

The following css is across the site and I can't change it. :

#main_inner h4, #main_inner h4 a{
 letter-spacing: 0;
  line-height: 155%;
  font-weight: bold !important;
  background-color: #f5f3f3 !important;
  color: #006c9f !important;
  text-transform: none !important;
}
#main h4:before, footer .widgettitle:before, h1.page_title:before, #sidebar h4.widgettitle:before, .about_author_title:before, #reply-title:before, #comments_title:before {
  content: "|||";
}

I'm trying to change the css to h4.top-video-title{background-color:none !important;} h4.top-video-title ::before{ content: "";}

but it isn't working. How do I change the css?

LTech
  • 1,677
  • 5
  • 29
  • 48

3 Answers3

1

You can use CSS Specificity to do the override. Use more selectors than the ones used in the legacy code you found on the site.

For instance:

#main_inner h4, #main_inner h4 a{
 letter-spacing: 0;
  line-height: 155%;
  font-weight: bold !important;
  background-color: #f5f3f3 !important;
  color: #006c9f !important;
  text-transform: none !important;
}
#main h4:before, footer .widgettitle:before, h1.page_title:before, #sidebar h4.widgettitle:before, .about_author_title:before, #reply-title:before, #comments_title:before {
  content: "|||";
}

If you want to override:

#main_inner h4

you need to use more selectors or a higher selector since they used an id.

Try

#main_inner h4.top-video-title{
   background-color:none !important;
}

I wrote a post about this a while ago: http://blog4coders.com/css-specificity/

Alessandro Incarnati
  • 7,018
  • 3
  • 38
  • 54
0

It seems to be the CSS priority, as the others have nested selectors. Try to use the same selectors as the existing ones, but adding body before:

body #main_inner h4, body #main_inner h4 a

and !important to the rule too, so you can increase the selector priority.

Ignacio
  • 688
  • 5
  • 17
0

Instead of none, use Transparent !important

h4.top-video-title { 
 background-color: Transparent !important;
}
Spooky
  • 1,235
  • 15
  • 17