为什么背景图片没有填满整个div

2024-06-24

我有以下代码显示SPAN里面一个DIV然后另一个DIV在它下面显示一些文本。我遇到的问题是当我调整浏览器大小时,文本和背景图像变得不合适。

这是图像未填满的屏幕截图DIV:

另外,当我调整大小时,文本全部错位:

这是 HTML:

<div id="subpageHeaderImageSection">
    <div id="subpageHeaderLeft">
        <!--<img src="theImages/wcu.png" style="z-index: 5; position: absolute; bottom: 0; left: 10%; width: 194px; width: 185px;"  />
        <span id="quoteText" style="z-index: 4;">
            We Have the Finest Physicians, Staff, and Systems for the Finest Healthcare
        </span>-->
    </div>
</div>
<div id="subpageFooter">
    <div id="subpageFooterLeft">
        <div style="z-index: 15; position: absolute; left: 0; padding-left: 20px; padding-top: 10px; font-weight: bold; color: #0000CC;">
            State-Of-The-Art-Technology
        </div>
        <div style="z-index: 14; position: absolute; left: 0; padding-left: 40px; padding-top: 35px; padding-right: 8px; font-weight: normal; color: #000000;">
            Our state-of-the-art technology ensures that we provide the finest healthcare. Our practice continuously invests in systems and equipment so that physicians can diagnose problems in the most accurate and efficient manner possible.
        </div>
        <div style="position: absolute; width: 90%; padding-top: 90px; padding-left: 5%; padding-right: 5%;"><hr /></div>
        <div style="z-index: 13; position: absolute; left: 0; padding-left: 20px; padding-top: 110px; font-weight: bold; color: #0000CC;">
            Advanced Electronic Medical Records
        </div>
        <div style="z-index: 12; position: absolute; left: 0; padding-left: 40px; padding-top: 135px; padding-right: 8px; font-weight: normal; color: #000000;">
            Our advanced electronic medical record improves patient care and gives physicians all of the important patient information they need in one place.
        </div>
        <div style="position: absolute; width: 90%; padding-top: 175px; padding-left: 5%; padding-right: 5%;"><hr /></div>
        <div style="z-index: 11; position: absolute; left: 0; padding-left: 20px; padding-top: 200px; font-weight: bold; color: #0000CC;">
            Premier Radiology Services
        </div>
        <div style="z-index: 10; position: absolute; left: 0; padding-left: 40px; padding-top: 225px; padding-right: 8px; font-weight: normal; color: #000000;">
            Filmless radiology capabilities provide rapid results and allow physicians to view images on an office computer screen within minutes. Our premier radiology services include MRI, CT scan, ultrasonography, nuclear medicine, bone densitometry and mammography. We offer computer-aided diagnosis (CAD), which is a tool to assist the radiologist in more accurately diagnosing breast disease.
        </div>
        <div style="position: absolute; width: 90%; padding-top: 310px; padding-left: 5%; padding-right: 5%;"><hr /></div>
        <div style="z-index: 9; position: absolute; left: 0; padding-left: 20px; padding-top: 335px; font-weight: bold; color: #0000CC;">
            Our Employees Make MyMed a Special Place
        </div>
        <div style="z-index: 8; position: absolute; left: 0; padding-left: 40px; padding-top: 360px; padding-right: 8px; font-weight: normal; color: #000000;">
            MyMed values each of our employees’ experience, diversity and dedication. Ideas and backgrounds that our employees bring to our company enable us to be more effective in anticipating and exceeding our patients’ needs and expectations. <a class="blueLinks" href="http://www.mymed.com/talented_people.aspx">Click here</a> for the opportunity to meet some of the employees who greatly contribute to our success.
        </div>
        <div style="position: absolute; width: 90%; padding-top: 430px; padding-left: 5%; padding-right: 5%;"><hr /></div>
        <div style="z-index: 7; position: absolute; left: 0; padding-left: 20px; padding-top: 455px; font-weight: bold; color: #0000CC;">
            Wide Range Of Insurances
        </div>
        <div style="z-index: 6; position: absolute; left: 0; padding-left: 40px; padding-top: 480px; padding-right: 8px; font-weight: normal; color: #000000;">
            A big advantage to using WESTMED Medical Group is the <a class="blueLinks" href="http://www.mymed.com/participating_insurance.aspx?id=473">wide range of insurance coverage</a> accepted. This means you should be able to keep your doctors even if you find you have to change insurance plans. We care equally about every patient regardless of the insurance provider.
        </div>
    </div>
    <div id="subpageFooterRight">
    </div>
</div>

这是CSS:

#subpageHeaderImageSection {
    position: relative;
    top: 0;
    width: 100%;
    height: 450px;
}
#subpageHeaderLeft {
    position: absolute;
    left: 0;
    float: left;
    width: 100%;
    height: 100%;
    background: url('../theImages/subpageHeaderImage.png') no-repeat;
    background-size: 100%;
}
#subpageFooter {
    position: relative;
    width: 100%;
    height: 555px;
    background: url('../theImages/bg_80_w.png');
    box-shadow: 0 0 10px #FFFFFF;
}
#subpageFooterRight {
    position: absolute;
    right: 0;
    width: 40%;
    height: 100%;
    float: right;
    background-color: #000000;
}
#subpageFooterLeft {
    position: absolute;
    left: 0;
    float: left;
    width: 60%;
    height: 100%;
}
#quoteText {
    position: absolute;
    bottom: 30%;
    left: 40%;
    overflow: hidden;
    font-family: 'daysregular';
    font-size: 30pt;
}

我非常希望得到帮助的两件事:

  1. 如何确保无论我如何调整大小,标题上的背景图像始终填满 DIV?
  2. 如何确保文本不会像第二张图片中那样相互重叠?

Use background-size: 100% 100%完全填充(可能被拉伸) 其他明智的使用background-size: cover正如@Andras所说

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

为什么背景图片没有填满整个div 的相关文章

  • 如何在不使用 Flexbox 的情况下水平对齐元素?

    有没有一种方法可以在不使用的情况下将 Web 组件彼此相邻对齐Flexbox 我知道它是一个很棒的工具 但不幸的是它不适用于 IE 9 或 10 我希望链接内的文本显示在图像旁边 JSFiddle 显示了工作代码 但是使用 FlexBox
  • UIWebview JS 性能比 iOS 6/7 上的移动 safari 慢吗?

    我们最近使用 iOS 应用程序中的大量 JavaScript 库测试了一些 HTML5 内容 该应用程序旨在在 UIWebview 中加载这些内容 本次测试使用了 iOS 6 我的团队没有观察到移动 Safari 浏览器出现任何明显的性能问
  • 带有 selectInputs 的 DT 数据表在选择后重置回左侧

    我在 Shiny 应用程序的 DT 数据表的列中使用 selectInputs 感谢一些帮助here https stackoverflow com questions 74620665 vertically center selectin
  • javascript 可以从父页面访问 iframe 元素吗?

    我的页面上有 iframe iframe 和父页面位于不同的域中 父页面上的 javascript 代码可以访问此 iframe 内的元素吗 如果页面来自不同的域 则不应该这样做 浏览器安全沙箱应该阻止这种类型的访问 当两个页面来自不同的时
  • Javascript 字符串/整数比较

    我在 HTML 中存储一些客户端参数 然后需要将它们作为整数进行比较 不幸的是我遇到了一个我无法解释的严重错误 该错误似乎是我的 JS 将参数读取为字符串而不是整数 导致我的整数比较失败 我生成了一个错误的小例子 我也无法解释 运行时以下返
  • 将我的 JSON 字符串格式化为 PHP 中的
      有序列表

    我正在为一个宠物项目开发一个简单的 CMS 我目前有一个 JSON 字符串 其中包含菜单结构的页面 ID 和父页面 ID 的列表 我现在想将此字符串转换为嵌套或分层列表 有序列表 我尝试过循环查找 但似乎最终得到了过于复杂的子类范围 我正在
  • 删除 HTML5 离线应用程序缓存

    我有一个带有关联的应用程序缓存清单的 HTML 文档 但现在我想暂时摆脱离线应用程序缓存 如果我从清单中删除对清单的提及标签 已经有缓存版本的浏览器将继续使用该缓存版本 如果我更新应用程序缓存清单 无论如何 仍然有一个应用程序缓存 删除离线
  • 如何在 Bootstrap 中将单选按钮设置为“选中”? [复制]

    这个问题在这里已经有答案了 我使用 Bootstrap 按钮作为单选按钮 http getbootstrap com javascript buttons http getbootstrap com javascript buttons 这
  • 更改打开的下拉菜单上向上箭头的颜色

    我正在使用 twitter bootstrap 2 0 1 我正在尝试更改下拉菜单的颜色 我已经设法改变了本身掉落的容器的颜色 但是我似乎找不到箭头来自哪里 有人知道我在哪里可以找到箭头来自的代码 以及如何更改它的颜色 箭头代码可以在lin
  • 如何在 Perl CGI 程序中进行分页和排序?

    这是我从 SQLite 数据库检索数据的表 它有很多记录 所以在 添加 按钮附近我需要类似的东西 lt lt gt gt 每当我点击时 它就会执行分页功能 另外 除了表每个标头 例如 UserName UserId 之外 我还需要排序 按钮
  • 如何使用 Flex 创建自定义马赛克

    我正在尝试使用 Flex 创建一个自定义马赛克 如下所示 除了框 4 的高度和宽度加倍之外 所有框的宽度都是父容器的三分之一 我设法达到以下条件 push group element ul push group element ul li
  • 通过标记或JS强制下载

    假设我在 CDN 来自 Rackspace 的云文件 上有一个文件 以及一个包含该文件链接的静态 html 页面 有什么方法可以强制下载此文件 以防止它在浏览器中打开 例如 mp3 我们可以让我们的服务器读取该文件并将相应的标头设置为 he
  • jQuery onclick 隐藏其父元素[关闭]

    很难说出这里问的是什么 这个问题是含糊的 模糊的 不完整的 过于宽泛的或修辞性的 无法以目前的形式得到合理的回答 如需帮助澄清此问题以便重新打开 访问帮助中心 help reopen questions 我想隐藏 li tag on a 使
  • 持续运行的 C# 代码 - 服务还是单独的线程?

    我有一个 NET 4 Web 应用程序 它有 3 个关联的独立项目 DAL BAL 和 UI 我正在使用实体框架进行数据库交互 我有代码循环遍历一堆数据库数据 根据找到的内容调用方法 然后更新数据库 我希望这段代码一直运行 同时 我希望用户
  • css bootstrap 下拉菜单在 IE 中看起来不同

    我正在使用CSS引导程序3 2 0 http getbootstrap com css 然而 当在 IE 中查看该网站时 菜单选项周围有一个黑色边框 而且下拉菜单按钮看起来也有所不同 如果您查看该网站http getbootstrap co
  • 如何转义 onClick 处理程序内 JavaScript 代码中的字符串?

    也许我只是想得太难了 但我在弄清楚链接的 onClick 处理程序内的某些 JavaScript 代码中的字符串上使用什么转义时遇到了问题 例子 a href Select a The and 是发生模板替换的地方 我的问题是项目名称可以包
  • Bootstrap 面板主体,内有表格

    我有一个引导面板 单击图标即可折叠并自动关闭 该面板内部包含一个全宽的表格 但只有在没有任何内容时才看起来像这样panel body 例如 这张桌子横跨面板的整个宽度和高度 看起来不错 但如果我可以有一个围绕桌子的类 我会更喜欢 但是 如果
  • 将带有 rowspan 和 colspan 的 XHTML 表转换为 LaTeX

    我一直在寻找将 HTML 表格转换为 LaTeX 的合适解决方案 我发现以下问题与我的要求相似 XML 表到 LaTeX https stackoverflow com questions 27021926 xml table to lat
  • 多个引导模式的滚动问题

    我有一个带有大量信息的模态页面 因此您需要滚动 该模式包含指向第二个模式的链接 When I 打开模态 1 单击链接打开模式 2 模式 1 保持在后台 然后关闭模式 2 以便我回到模式 1 modal 1 失去滚动 仍然有一个滚动条 但它不
  • 单击即可切换背景颜色和过渡

    这看起来应该很容易 但我真的找不到办法做到这一点 动画 http doir ir css gif http doir ir css gif 当您单击这些相应的链接时 我需要更改和过渡页面的背景颜色 我见过的最接近触发这种类型转换的事情是 仅

随机推荐