0

I am making a child theme out of a parent theme. In the child theme i have some div's which should behave (style-wise) almost exact the same as div's in the parent theme. Parent theme has HTML Wysiwyg

And in my child theme i like to use HTML Wysiwyg

How can i give div "edButtonHTMLChild" the same .css style as edButtonHTML without altering the parent .css file?

Something like

#edButtonHTMLChild = #edButtonHTML 

regards

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
alex
  • 4,804
  • 14
  • 51
  • 86
  • I'm not sure I understand, why don't you just use the 'parent css' for the 'child' page/div as well? – paddotk Jul 06 '12 at 14:07

4 Answers4

1

If it has styles applied with direct classes then you can add those classes to the class list. If it is styled by ID then you will have to copy the CSS rules to a selector that targets your custom element.

prodigitalson
  • 60,050
  • 10
  • 100
  • 114
  • yes it's styled by id :( and it's a bunch of css rules. That's why i wanted to use some kind of inheritance. – alex Jul 10 '12 at 14:27
1

Normal CSS does not support inheritance; you need to add the child's selector to the parent's ruleset:

#edButtonHTMLChild, #edButtonHTML{
  styles...
}

or use Javascript to apply the same styles.

BryanH
  • 5,826
  • 3
  • 34
  • 47
Christoph
  • 50,121
  • 21
  • 99
  • 128
1

As mentioned, normal CSS does not support inheritance. If inheritance is something that you want, as well as a plethora of other capabilities, perhaps give Sass or LESS a go.

Vin Burgh
  • 1,399
  • 1
  • 8
  • 14
1

If you don't want to copy CSS or use something like LESS, you could use some javascript that copies the styles of an element and applies them to your element. Check out this thread:

jQuery CSS plugin that returns computed style of element to pseudo clone that element?

Community
  • 1
  • 1
Drkawashima
  • 8,837
  • 5
  • 41
  • 52