Re: negative margin for sup/sub-scripting

On 31/07/2014 7:22 PM, Rafał Pietrak wrote:
> Hello the list,
>
> Checking on sub/super-script styling, from
> (http://www.w3.org/TR/CSS2/box.html) I read: "Negative values for margin
> properties are allowed, but there may be implementation-specific limits."
>
> Bo I tried the negative margin values, and they don't give an "expected
> results" of "collapsing" the space used up by a superscript box
> (example: http://jsfiddle.net/KxRx6/). I understand, that that's why
> people are struggling to control line height and style the
> super/sub-scripting by other means (example:
> http://stackoverflow.com/questions/501671/superscript-in-css-only).
>
> I'm not quite sure why negative margins don't work for those cases. Was
> there any additional specs since CSS2 above (that would give authors the
> "expected disregard for box-height" in cases such as line height
> coordination when sub/super-scripting is used)? If not, could that be
> considered? To the point where a declaration like "{margin: -100%}"
> would make a box not use any space at all ... while still being
> displayed with it's ordinary height/width, and at the original position?
> Could the freedom in "implementation-speciffic limit" of CSS2, currently
> be a little more constrained with an explicitly stated implementation
> requirements like the above?
>
> -R

The reason it does not work is because <sup> is an inline element. See 
'margin-top', 'margin-bottom'  in section 8.3 [1] where it states:

   | These properties have no effect on non-replaced
   | inline elements.

If you change it to 'display:inline-block', the line is shifted enough 
where there is no extra space between each <tr>


1. http://www.w3.org/TR/2011/REC-CSS2-20110607/box.html#margin-properties


Alan

Received on Thursday, 31 July 2014 10:21:40 UTC