2008年12月30日

IE8 的 CENTER 設定 CSS

今天早上在 IE8 上測試自己的部落格,點了一個選項後,卻沒有出現預期的效果;但是改用 Firefox, Safari, Chrome 卻都正常。下面列出了三個寫法。第一個與第二個都正常,但第三個會出錯。

點選下面的 window 會跳至指定的網頁。

  • 程式用法:

    <center>
    <a href='http://ant4js.blogspot.com/2008/12/window.html'>window</a>
    </center>

  • 執行結果:

    window

點選下面的 window 會跳至指定的網頁。

  • 程式用法:

    <style type='text/css'>
    .ctr1 {width:100%;
           background:#555555
          }
    </style>
    <center class=ctr1>
    <a href='http://ant4js.blogspot.com/2008/12/window.html'>window</a>
    </center>

  • 執行結果:

    window

在 IE8 瀏覽器,點選下面的 window 會發生錯誤。

  • 程式用法:

    <style type='text/css'>
    .ctr2 {
           background:#555555
          }
    </style>
    <center class=ctr2>
    <a href='http://ant4js.blogspot.com/2008/12/window.html'>window</a>
    </center>

  • 執行結果:

    window

你可以用不同的 CSS 特徵去測試,看看哪些特徵會導致此錯誤。


©2008-2009 by ant2legs, All Rights Reserved. ant2legs 擁有其製作的文章,圖片與程式的著作權,所有權利保留。