homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

<sup> and degree Celsius

 9:57 am on May 10, 2011 (gmt 0)

SUP does not work but celsius degree work?
I have the same code like:
m<sup>2</sup> (does not work)and

<sup></sup> works?



 2:23 pm on May 10, 2011 (gmt 0)

What do you mean by "does not work"? Do you mean your browser doesn't recognize the <sup> statement? They didn't leave it out of HTML 5 did they?

I hate to break it to you, but is the generic degree sign. By itself it conveys no further information; it could just as well mean degrees of latitute. And the character itself is raised, like and and a handful of others, so it doesn't need superscript notation.


 12:44 pm on May 11, 2011 (gmt 0)

Hi toplisek, I second lucy24 -"does not work" could mean lots of things. <sup> has very wide browser support, so if it isn't "working" then I expect something in the code is affecting the element.

As lucy24 says, the degree ( &#176; or &deg; ) produces a symbol in the superscript position, without the need for <sup>. If you are trying to indicate "metres squared" (m2), then &#178; or &sup2; will produce a "2" in the superscript position without requiring <sup> as well.

However, you've asked about <sup> in another thread [webmasterworld.com], so I think the real issue is why <sup> isn't working in your code.

@lucy24 - <sup> looks like it is going forward into html5 - and isn't listed as "at risk".


 7:30 am on May 19, 2011 (gmt 0)

It works correct with an error:

Error message: general entity "sup2-12m" not defined and no default entity

Code: &#178
Error message: reference not terminated by REFC delimiter

Pages are stored as UTF-8


 9:33 am on May 19, 2011 (gmt 0)

:: after staring at error messages in blank puzzlement for several minutes ::

Oh. I get it. You're garbling your entities. I thought you'd got entities and tags mixed up.

For starters, is a character. You can enter it as-is in both UTF-8 and Latin-1 encoding. If for some reason you must use entities, you can use a named entity
a decimal entity
or a hexadecimal entity

So "REFC delimiter" is just a grandiose way of saying "semicolon". (Yes, OK, I looked it up. Reference Close.) The validator gets very upset when an ampersand is followed by anything other than an entity name.

That's assuming you really do want to use . There are good arguments against using the characters in HTML. Only those three are in Latin-1. The other numerals are further up in Unicode and will probably not match visually. Superscripts are safer, and you have more control over the result.

In your initial post you said
wasn't working. You never did explain what it did wrong, or failed to do right.

Oh, and we never did get around to what any of this has to do with CSS. Except that you can say things like
sup {font-size: 80%; line-height: .5em; vertical-align: 50%;}
et cetera ad lib to make sure your superscripts aren't subject to the whims of other people's browsers.
Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved