0

我正在寻找类似于所示图像的东西:

在此处输入图像描述

我已经设法使#wrap 水平居中,但仅此而已……任何帮助将不胜感激。

<style>
    #wrap
    {
    Margin-left:auto;
    Margin-right:auto;
    padding: 10px;
    }

    #content
    {
    padding: 10px;
    }
</style>

~~~

<body>
    <div id="wrap">

       <div id="content">
       1
       </div>
       <div id="content">
       2
       </div>
       <div id="content">
       3
       </div>

    </div> <!--end wrap-->
</body>
4

1 回答 1

0

Since you're working with block elements (https://developer.mozilla.org/en-US/docs/HTML/Block-level_elements) you need the inner elment to have a fixed height so that you can give position: absolute. Additionally, keep in mind that the ID of an element has to be unique. If you want to use an element mulitple times assign a class name, e.g.

<div class="content">1</div>
<div class="content">2</div>
<div class="content">3</div>

So, for the whole matter have a look at http://jsfiddle.net/YFncP/253/

Hope this helps.

于 2013-05-06T07:09:54.947 回答