HTML DOM CSS position的用法

來源:互聯網
上載者:User

文法:

Object.style.position=static|relative|absolute|fixed

可能的值

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title><style type="text/css">td{width:60px;height:59px;}.staticSpan{position:static;left:40px;}.relativeSpan{position:relative;top:20px;left:20px;}.absoluteSpan{position:absolute;top:100px;left:100px;}.fixedSpan{position:fixed;top:200px;left:200px;}</style></head><body><table width="500" border="1" cellspacing="0" cellpadding="0">  <tr>    <td > </td>    <td><span class="staticSpan">static<span></td>    <td> </td>    <td> </td>    <td> </td>  </tr>  <tr>    <td height="47"> </td>    <td> </td>    <td><span class="relativeSpan">relative</span></td>    <td> </td>    <td> </td>  </tr>  <tr>    <td height="41"> </td>    <td> </td>    <td><span class="absoluteSpan">absolute</span></td>    <td> </td>    <td> </td>  </tr>  <tr>    <td height="35"> </td>    <td> </td>    <td> </td>    <td><span class="fixedSpan">fixed</span></td>    <td> </td>  </tr></table></body></html>

效果如下:

  static       
    relative    
    absolute    
      fixed  
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.