View Full Version : Unsetting properties in CSS


Jellby
06-02-2009, 02:33 PM
Hi all,

I have a feeling this can't be done, but I thought I'd ask anyway. The problem comes when trying to format drop caps and there is some punctuation before the drop cap, as in:

«ˇBendito sea el poderoso Alá!»

where only the B should be a real "drop cap", but the previous content should remain there, before the B.

With the usual code, the drop cap is set as "float", and the punctuation has to be inside the float if it has to keep its place, but only the B has to be big, bold, with a special font or whatever, so the code is something like this:

<p><span class="drop"><span class="predrop">«ˇ</span>B</span>endito sea el poderoso Alá!»

Now, I know how to "cancel" some settings I could use for ".drop" so that they don't affect ".predrop". If one has "font-weight:bold", then the other has "font-weight:normal"; "font-size:400%" is cancelled by "font-size:25%", etc. But how can I cancel "font-family:my_custom_font"? The most I can get is using "font-family:serif", but that's not good enough, because there's no guarantee the user has a default serif font, and I don't want to force it...

I wish I could use "font-family:default", or have a selector that targets only ".drop" but not its descendants, or inherit from the grandparent, or something else. Any ideas? :chinscratch:

kovidgoyal
06-02-2009, 02:41 PM
AFAIK, the user is guaranteed to have default serif, sansserif, monospace, cursive and fantasy fonts.

Jellby
06-03-2009, 04:29 AM
AFAIK, the user is guaranteed to have default serif, sansserif, monospace, cursive and fantasy fonts.

Maybe I didn't explain myself. I mean I don't want to force "serif" for the ".predrop", since the user (or the reader) might have "sans-serif" as the default font, and likewise for any other font selection command. I want the "font-family" property to be whatever-default-applies-for-this-user-and-system.

I guess I could do something like:

<span class="drop"><span class="predrop">«ˇ</span><span class="cap">B</span></span>

and just

<span class="drop cap">B</span>

for the simple cases. I'll have to try this.