Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Feb 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question CSS and Special Characters

    Does anyone know if there is a way (CSS2 or 3) to apply CSS to special characters? For instance,

    Code:
    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?

  • #2
    New Coder
    Join Date
    Feb 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    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.

  • #4
    New Coder
    Join Date
    Feb 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by CyanLight View Post
    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:

    Code:
    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:

    Code:
    <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.

  • #5
    Regular Coder Candygirl's Avatar
    Join Date
    Apr 2008
    Location
    Switzerland
    Posts
    184
    Thanks
    3
    Thanked 56 Times in 56 Posts
    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).
    But they don't help in your case...
    Last edited by Candygirl; 05-15-2008 at 05:18 PM. Reason: Thank you Donkey ! :)
    "Imagination was given to man to compensate for what he is not;
    a sense of humour to console him for what he is."
    -Francis Bacon

  • #6
    Regular Coder Donkey's Avatar
    Join Date
    Sep 2003
    Location
    Blackfield UK
    Posts
    312
    Thanks
    1
    Thanked 36 Times in 36 Posts
    Quote Originally Posted by Candygirl View Post
    As you've seen, English is not my mother language. Please help me to improve it
    At my opinion
    should be
    In my opinion
    " 90% of everything is crud" - Theodore Sturgeon
    Filthy Beast - a 60's Rock Band

  • #7
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •