Sent by Jukka K. Korpela on 7 February 2010 16:04
Eduardo Varela wrote:
>>> For an educational site aimed at mathematics I want to say (4^3) ^
>>> 2 the way maths books do it.
>>
>>> but I want the second exponent (the number "2"), to be in a higher
>>> position that the first (the number "3"). How could it be done?
- -
>> You do not need css to accomplish your goal
>> The following HTML does the job.
>> x<sup>2<sup>2</sup></sup>
It's a solution to a different problem than was asked.
When you nest superscripts, as in a<sup>b<sup>c</sup></sup>, you create an
expression where the exponent itself is an exponential.
What you originally asked was of the form (a<sup>b</sup>)<sup>c</sup>, which
is something completely different.
Superscripts are tricky in formatting, in general. Browsers use different
and often typographically inferior rendering for them - see
http://www.cs.tut.fi/~jkorpela/math/#subsup for a description of some issues
and approaches.
In the original question, you would want to raise a <sup> element higher
than another. That's possible in CSS, using vertical-align, which is not
extremely consistently supported, but often good enough. Since, in this
question, you don't have <sup> elements nested, you would probably need to
use a class attribute and a class selector.
Then you need to consider the issue that <sup> element font-size tends to be
smaller than that of surrounding text, by browser defaults. As you don't
know how much, and as you, as an author, unlike web browser designers, know
what you are using <sup> for, it's a good idea to set <sup> font size
explicitly. This is also useful for setting the vertical alignment, since
the most robust way is to use the ex or the em unit, which relate to the
element's own properties, thereby depending on its font size.
So you might consider something like the following:
Markup:
(4<sup>3</sup>)<sup class="outer">2</sup>
CSS:
sup { font-size: 85%; }
sup { vertical-align: 0.9ex; }
sup.outer { vertical-align: 1.5ex; }
On the other hand, I'm not sure it is common practice in mathematics to have
outer exponents higher, in a case like this. But I haven't done or read much
math since the 1970s...
--
Yucca, http://www.cs.tut.fi/~jkorpela/
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/