Welcome to WebmasterWorld Guest from 54.205.20.160

Forum Moderators: not2easy

Message Too Old, No Replies

<sup> and degree Celsius

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

WebmasterWorld Senior Member 5+ Year Member



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)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



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)

WebmasterWorld Senior Member 5+ Year Member



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)

WebmasterWorld Senior Member 5+ Year Member



It works correct with an error:

Code:12m&sup2
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)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



:: 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
&sup2;
a decimal entity
&#178;
or a hexadecimal entity
&#x00B2;

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
m<sup>2</sup>
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.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month