【问题标题】:how to adjust left and right background in html css?如何在html css中调整左右背景?
【发布时间】:2012-10-25 16:08:29
【问题描述】:
<div class="wrapper">
    <div class="left-bg bg-part" id="left-bg">

    </div>

    <div class="content-hold" id="content-hold">
 </div>
    <div class="right-bg bg-part" id="right-bg">

    </div>

</div>

这是我写的较少的 css 代码。

 .wrapper {
        .bg-part {
          width: 30px;
          background: #a2ca46;
          height: 100%;
          position: absolute;
          top: 0;

        }
        .left-bg {
          float: left;
          left: 0;
        }
        .right-bg {
          float: right;
          right: 0;
        }
    }

当内容在页面上占据更多位置时,左侧和右侧的高度永远不会增加。我应该怎么做才能使 left-bg 和 right-bg 杠杆到内容保持的宽度。

【问题讨论】:

  • 我在左边有一个 30 像素的背景,在右边有 30 像素。当更多内容添加到 content-hold 时,它不会显示在整个页面上。
  • 我猜你英文不太好,mmmm有一点,让我试试

标签: javascript html css


【解决方案1】:

一种选择是使用一行三列的 html 表格。根据需要设置左右列的宽度各 30px。

【讨论】:

    猜你喜欢
    • 2012-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多