三个彼此相邻的 DIV,具有流畅的水平宽度

发布于 2024-11-26 00:09:06 字数 76 浏览 2 评论 0原文

我需要知道如何将所有三个 div 与所有不同的背景图像对齐,中间的 div 需要为 989px,左 div 和右 div 的宽度并不重要。

I need to know how to align all three divs next to eachother with all different background-images and the center one needs to be 989px the left div and right div their widths doesn't matter.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恋竹姑娘 2024-12-03 00:09:06

简而言之.. http://jsfiddle.net/hobobne/qyGC5/

<style>
.sides {display: inline-block; width: 100px; border: 2px dotted green;}
#main {display: inline-block; width: 200px; border: 2px dotted blue;} /* you can change this to 989px */
</style>
<div class="sides">side 1</div><div id="main">main</div><div class="sides">side 2</div>

编辑: 最终解决方案:http://jsfiddle.net/hobobne/qyGC5/4/

In a nutshell.. http://jsfiddle.net/hobobne/qyGC5/

<style>
.sides {display: inline-block; width: 100px; border: 2px dotted green;}
#main {display: inline-block; width: 200px; border: 2px dotted blue;} /* you can change this to 989px */
</style>
<div class="sides">side 1</div><div id="main">main</div><div class="sides">side 2</div>

EDIT: The final solution: http://jsfiddle.net/hobobne/qyGC5/4/

倒带 2024-12-03 00:09:06
<style type="text/css">
  #wrapper {
  }

  #wrapper div {
    float : left;
  }

  #wrapper #left {
    width : 300px;
    background-image : "/path/to/an_image";
  }
  #wrapper #center {
    width : 989px;
    background-image : "/path/to/another_image";
  }
  #wrapper #left {
    width : 200px;
    background-image : "/you/get/the/idea";
  }
</style>

<div id="wrapper">
  <div id="left"></div>
  <div id="center"></div>
  <div id="right"></div>
</div>
<style type="text/css">
  #wrapper {
  }

  #wrapper div {
    float : left;
  }

  #wrapper #left {
    width : 300px;
    background-image : "/path/to/an_image";
  }
  #wrapper #center {
    width : 989px;
    background-image : "/path/to/another_image";
  }
  #wrapper #left {
    width : 200px;
    background-image : "/you/get/the/idea";
  }
</style>

<div id="wrapper">
  <div id="left"></div>
  <div id="center"></div>
  <div id="right"></div>
</div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文