Pro Theme Design Forum » Mimbo Pro » Technical Help

Child theme css

  • Started 1 year ago by Martin
  • Latest reply from Martin
  • This topic is not a support question

  • Martin
  • Member
  • Posted 1 year ago #

Hi guys,

I posted this question elsewhere in the forum, but I get the impression a number of the forum users would benefit from any answers you could suggest, so a new thread seemed appropriate.

I've created a child theme for my site, and all is working fine.

For the child theme, I reproduce some css that's in the parent style.css file in the child theme's style.css file, and it works just fine. The child theme style.css items take preference as expected.

However, I also need to change items that are in the parent theme's home.css. This only seems to work if I put the relevant code in the child theme style.css AND comment it out in the parent theme home.css.

Please can you advise if there's a way of having the child theme style.css take preference (be the settings that are applied) when it contains some values that are held in other parent files, such as home.css?

This would be a big help, as I find I have to re-edit files each time I upgrade the parent theme.

Any tips much appreciated!

Thanks, Martin

I think the trick you're looking for is the "!important" rule, which overrides any previously declared styling. It looks like this and is especially useful in child themes:

.catnews img {margin:6px 13px 8px 0 !important}

Is that how you mean? More on that rule here. It's used quite a bit in the Basic Starter theme.

  • Martin
  • Member
  • Posted 1 year ago #

Hi Darren,

That does exactly what I was after, thanks!

I had seen it in your child themes and neglected to read up on it. Now I know!

Thanks for your quick reply.

Martin

Reply

You must log in to post.