CSS Styling within a html block
Permalink
Hi
I am trying to style some buttons within a html block. My code is something like this:
The styling does not get picked up. However, if I use inline CSS, it works:
Please could someone help me out here. How can I style all my buttons without resorting to inline coding for this particular block? I read something about custom templates but I am not a programmer and would like to avoid anything too complicated as far as possible.
Thanks!!
I am trying to style some buttons within a html block. My code is something like this:
<style> button.qq{ color:red; background-color:black; } </style> <button class="qq"> Click Me! </button>
The styling does not get picked up. However, if I use inline CSS, it works:
<button style="color:red;background-color:black"> Click me!</button>
Please could someone help me out here. How can I style all my buttons without resorting to inline coding for this particular block? I read something about custom templates but I am not a programmer and would like to avoid anything too complicated as far as possible.
Thanks!!
Many thanks. Did you mean to say I should use a combination of id+class? I fiddled with the code, did this and it works!
<style> #mm.qq{ color:red; background-color:black; </style> <button id="mm" class="qq"> Click Me!</button>
What you have done there is tighter than I was originally suggesting, having the benefit of being just for that one button, so it cant spill out to anything else.
However, if it is that specific, you could just as well have put the styles in the button like you tried at first :)
However, if it is that specific, you could just as well have put the styles in the button like you tried at first :)
What you need is a stronger rule for the style section. Use an #id that is a close container.
If that isn't strong enough, you can also make a rule !important:
(be careful, it could have side effects if your rule/selection is too general).
If you use the Chrome developer console or firebug, on the elements tab you can see an analysis of how rules are prioritised and what is overruled when for any dom element.
http://www.concrete5.org/documentation/how-tos/editors/getting-help...