【问题标题】:DIV moves 1px on page zoomDIV 在页面缩放时移动 1px
【发布时间】:2013-05-18 05:48:34
【问题描述】:

我正在处理的网站上有一个固定的标题。所以我的页面内容在页眉下流动,页眉固定在页面顶部。我不能使用css中的border-radius函数来创建我想要的圆角,因为页面内容背景颜色显示在我的圆角的外侧。所以我实现了两个圆角图像,一个用于左侧,一个用于右侧。我的问题是,当我缩放时,图像总共移动了 1px。无论我放大多少,它总共只移动了 1px,对于我的生活,我似乎无法弄清楚问题所在。我将发布一个指向我的网站的链接,也许有人可以通过 html 和 css 并尝试解决这个问题。我还放了一个链接来下载我的 VB 项目以在 Visual Studio 中查看。非常感谢任何帮助。

链接到网页 http://aspspider.info/speeddemon8406/Default.aspx

VB项目下载链接 http://www1.datafilehost.com/d/46288e83

【问题讨论】:

    标签: asp.net html header fixed rounded-corners


    【解决方案1】:
    #header {
      background-color: #ddd;
      height: 125px;
      left: 50%;
      margin-left: -480px;
      position: fixed;
      width: 960px;
    }
    #header-top {
      background-color: #fff;
      border-left: 1px solid #aaa;
      border-radius: 25px 25px 0 0;
      border-right: 1px solid #aaa;
      border-top: 1px solid #aaa;
      height: 85px;
      width: 958px;
    }
    #nav-wrapper {
      background-color: #fff;
      border-left: 1px solid #aaa;
      border-right: 1px solid #aaa;
      width: 958px;
    }
    #nav {
      background-color: Orange;
      border-radius: 15px 15px 0 0;
      height: 40px;
      margin: 0 1px;
      width: 956px;
    }
    
    #topleftcorner,#toprightcorner,#nav-corner-left,#nav-corner-right{display:none;}
    

    基本思想是我在#header(页面背景颜色)上添加了#ddd 颜色。然后我在#header-top 上使用border-radius 来圆角。我还将白色背景应用于#nav-wrapper。然后我只是修复边框,并删除不必要的图像。

    至于你的 1px off 问题,这是一个四舍五入的错误。我从 #header 中删除了 left:0;right:0 并将其替换为 left:50%;margin-left: -480px,这样它就不会发生。

    【讨论】:

    • 我不敢相信你解决了我的问题。我花了很多时间试图弄清楚这一点,却走错了方向。非常感谢。你让我省了很多麻烦。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-07
    • 2016-02-12
    • 2020-12-24
    • 1970-01-01
    • 1970-01-01
    • 2012-12-02
    • 1970-01-01
    相关资源
    最近更新 更多