【问题标题】:Element not moving on resizing page元素在调整页面大小时不移动
【发布时间】:2012-07-19 23:47:48
【问题描述】:

我正在使用以下代码在 HTML 页面上放置标题/标题:

<table width="100%" height="55px" border="0" cellpadding="0" cellspacing="0">
    <tr>
         <td style="height:10px">&nbsp;
         </td>
    </tr>
    <tr>
        <td style="width:105px;"></td>
        <td align="left"  style="padding-right:10px;padding-left:10px">

        <div style="font-family:quicksand;font-size: 28px; color:##bdbdc0;z-         index:1000000;position:relative;">
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            De Graef    <font size="2">Landelijk & Sfeervol Wonen</font>
        </div>

        </td>
    </tr>
</table>

其他内容在其他表格中。

当我放大或缩小,或只是更改分辨率时,此文本不会与其他页面元素同步移动其位置。

有什么想法吗?

【问题讨论】:

  • 你应该在 jsFiddle.net 中重新创建它,它会让我们更容易帮助你。
  • 验证您的代码 - 其中一半已弃用 - 表没有 colspan,语法有很多错误。
  • 请查看页面antiek.net/degraef/new2

标签: html css html-table


【解决方案1】:

将标题行更改为:

<tr>
    <td align="center" style="font-family:quicksand;font-size: 28px; color:##bdbdc0;margin-left:-50px;background-color:##4D4946;">
        <table width="956" border="0" height="100%" cellspacing="0" cellpadding="0" style="background-color:##4D4946;">
            <tbody>
                <tr>
                    <td style="background-color:##4D4946;">
                        <br>
                        <br>
                        <img style="background-color:##4D4946;" src="images/logonew.png">
                    </td>
                </tr>
            </tbody>
        </table>
    </td>
</tr>

我在这里为您提供帮助,但应该认真考虑以简洁现代的方式重写所有代码,您的大部分代码已弃用

  • 使用适当的 HTML 标记来分割您的文档
  • 仅在需要实际表格时使用&lt;table&gt;
  • 使用单独的 CSS 文件保持标记干净
  • ReadW3C 关于这一切的建议

【讨论】:

    猜你喜欢
    • 2016-05-02
    • 2016-07-06
    • 1970-01-01
    • 1970-01-01
    • 2017-09-04
    • 1970-01-01
    • 2022-01-12
    • 2012-02-09
    • 1970-01-01
    相关资源
    最近更新 更多