Forum

Yampiz Forum

Sharing let knowledge Spreaded, Reading let spirits growth, Creative let culture extended, Let us
  • 禁止廣告文
  • 知識傳播
  • 閱讀
  • 心靈成長
  • 創作
  • 文化傳承
Dictionary / Programming / 網頁/網站程式 / CSS /

div 裡的 table 在 Firefox 無法置中問題

New Subject
Random
Previous
Next
|
    div 裡的 table 在 Firefox 無法置中問題

    ???問題:

    平常用 div 來作置中的動作,像這樣 <div style="text-align:center;">ABC</div>,今日才突然發現,放在 div 裡的 div 及 table 於 Firefox 瀏覽器中都不受 CSS:text-align 的控制,但在 IE 中都是正常的,唯有把 div 加上 <div align="center"> Firefox 才會接受,如此又變得不符合 W3C 。

    解決:

    在 Firefox 中 text-align 是控制文字的, div table 那些的位置不受這控制,除了舊式 table 方式的排版外,用 block 級元素來排版就一定要將重要 ( 不可變 ) 的欄位指定寬度,搭配 margin 讓 margin 左右交給瀏覽器自動調整。

    <div style="text-align: center">
    <table style="margin:0 auto;width:300px;">
    <tr><td>ABC</tr></td>
    </table>
    <div>

    • Keywords : table, align, style, margin, center, Firefox, 變得不符合, 級元素來排版就一定要, 瀏覽器自動調整, 欄位指定寬度, 位置不受這控制, width, block, 300px
    00
    2009-10-26T09:46:45+0000


    • Now, you can post comments by Facebook Account when your Yampiz account was logout or unvariable. whatever, we suggest to post comment by Yampiz Account to get more bounds to join new events of Heyxu
    Comment
     
    Verify
    Comment

    Facebook Page

    QR-Code and APP Launcher

    User Guide
    This Webpage

    In those service tabs, "Scan QRCode, in mobile device" or "Click the button, in this device" to open webpage or APP-related operations.
    QRCode
    • Auto Platform
      For better browsing experience, it will auto detects your device to display webpage.
    • Bug Report
      Tell us about the idea, problem and errors you found.
    • Comodo Secure
      The sensitive data transmission adopts by SSL-2048 authenticated encryption.
    • Copyright
      © 2009 YamPiz Digital Inc. & Jaby Group. All rights reserved.
    • Revised Version
      V2.2.552
      05 Dec 2025 (GMT+8)