On 11/1/2012 4:50 PM, Jukka K. Korpela wrote:
2012-11-01 22:32, Mike Breiding - Morgantown WV wrote:

I cannot get this declaration to work:
p.date
{margin-bottom:-10px; margin-top: 40px}

It would in general be useful to specify what "to work" means, i.e. what
is the expected effect and how the rendering differs from it.

To me, this was obvious.
But I see now it might only be obvious to me as I ahve been a bit fixated on it.

However, in this case, if you open the page...
http://epicroadtrips.us/2010/mich-ont/betsy_journal/index.php
e.g. in Chrome, right-click a paragraph in the "date" class and select
"Inspect element", you will see, under "Matched CSS Rules", that the
element matches the rule but the rule is overstruck. And the reason can
be seen there too: there is also the rule with the selector

div#content p

and it sets the margin property. As the selector is more specific than
p.date by the cascade rules, this declaration wins.

To make your rule apply to the paragraphs, you can e.g. replace the
selector p.date by

div#content p.date>
which is even more specific than the selector that now wins.

Ah-ha! This fixed the problems and a good lesson is learned: Be specific!
Thanks,
-Mike



Yucca

______________________________________________________________________
css-discuss [css-d@lists.css-discuss.org]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to