PDA

View Full Version : CSS and Special Characters



wkdown
05-15-2008, 02:19 PM
Does anyone know if there is a way (CSS2 or 3) to apply CSS to special characters? For instance,



p { font: 10px Arial, sans-serif; }

<p> Here is some text for SomeCompany&trade; </p>


Doing this causes the trademark symbol to use the 10px sizing of the paragraph tag, where it should be smaller. I don't want to use span styles or classes around it if I can help it. This rule applies mostly to trademark, copyright, reserved, exponents, degrees, and other sub/superscript special characters.

Anyone have any insight?

wkdown
05-15-2008, 04:06 PM
I should add that I dont want to surround them with CSS'd <sup> or <sub> tags. I'm looking to see if there is pure CSS for special characters

Apostropartheid
05-15-2008, 04:24 PM
Nope. <sup> and <sub> automatically use CSS declarations vertical-align: super & sub, respectively, which I believe is the intended way of displaying them; although I'm a bit hazy on this bit of typography.

wkdown
05-15-2008, 04:40 PM
Nope. <sup> and <sub> automatically use CSS declarations vertical-align: super & sub, respectively, which I believe is the intended way of displaying them; although I'm a bit hazy on this bit of typography.

Thanks, but what I meant is:



p { font-size: 10px; }

<p> This text is 10px tall for Company&trade; </p>


The "TM" will be 10px tall. My comment about the <sup> and <sub> tags meant I was not looking for:



<p> This text is 10px tall for Company<sup style="font-size:smaller">&trade;</sup> </p>


.. as that does nothing to alleviate the the problem. I was more hoping for a type of CSS designator that fits all special characters.

Candygirl
05-15-2008, 05:01 PM
In my opinion there is no way to do it in css.

The css selectors can select an element, not part of the element's content, except some pseudo-elements such first:letter or ::selection (css3 (http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#selectors)).
But they don't help in your case... :(

Donkey
05-15-2008, 05:12 PM
As you've seen, English is not my mother language. Please help me to improve it :)


At my opinionshould be
In my opinion :)

Apostropartheid
05-15-2008, 11:05 PM
But sup is already in superscript. It’s smaller. What’s the problem you’re having with that, because I see none?

You could use ems to make the text smaller. The size of the sup would change along with the font size dynamically.