HTML/CSS/Text/sup

Материал из Web эксперт
Перейти к: навигация, поиск

Superscript and subscript

   <source lang="html4strict">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 <title>Superscript and subscript</title>

</head> <body>

a2 + b2 = c2

H2SO4

</body> </html>

</source>
   
  


To superscript text use sup tags

   <source lang="html4strict">

<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns = "http://www.w3.org/1999/xhtml">

  <head>
  </head>
  <body>

You may download 3.14 x 102 </p> </body> </html> </source>

vertical alignment for sub super

   <source lang="html4strict">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  <html>
       <head>
           <title></title>
           <style type="text/css">
               p {
                   font-size: 16px;
               }
               span {
                   font-size: 0.8em;
               }
               p#sub span {
                   vertical-align: sub;
               }
               p#super span {
                   vertical-align: super;
               }
           </style>
       </head>
       <body>
           <p id="sub">
              This is normal text. This is subscript text. This is normal text.
           </p>
           <p id="super">
              This is normal text. This is superscript text. This is normal text.
           </p>
       </body>
   </html>
</source>