将HTML放在正确的位置

时间:2015-09-04 09:53:00

标签: html css

Sup人。我无法使用与块相同的方式使用块的bew页面。我有这个高块的问题,称为“包”。我试过flex-box,我试过漂浮。也许有人可以帮助我按照预期的方式放置所有东西。

figcaption
{
	position: absolute;
	width: 100%;
    height: 41px;
	bottom: 0px;
	padding-top: 13px;
	padding-left: 20px;
    font-size: 21.333px;
    font-family: "SegoeUIBold";
    opacity: 0.8; 
    background-color: #FFF;
}

figure
{
	position: relative;
	cursor: pointer;
	float: left;
	margin-right: 10px;
	margin-bottom: 10px;
}
<main>
      <figure class="huge">
        <img src="img/greenTshirt.png" alt="">
        <figcaption>T-Shirts</figcaption>
      </figure>
      <figure class="normal">
        <img src="img/cards.png" alt="">
        <figcaption>Cards</figcaption>
      </figure>
      <figure class="normal">
        <img src="img/pens.png" alt="">
        <figcaption>Pens &amp; Pencils</figcaption>
      </figure>
      <figure class="wide">
        <img src="img/notebooks.png" alt="">
        <figcaption>Notebooks</figcaption>
      </figure>
      <figure class="normal">
        <img src="img/toys.png" alt="">
        <figcaption>Toys</figcaption>
      </figure>
      <figure class="high">
        <img src="img/bags.png" alt="">
        <figcaption>Bags</figcaption>
      </figure>
      <figure class="normal">
        <img src="img/scrum.png" alt="">
        <figcaption>Scrum cards</figcaption>
      </figure>
      <figure class="normal">
        <img src="img/magnets.png" alt="">
        <figcaption>Magnets</figcaption>
      </figure>
      <figure class="big">
        <img src="img/redCaps.png" alt="">
        <figcaption>Caps</figcaption>
      </figure>
      <figure class="normal">
        <img src="img/magnets.png" alt="">
        <figcaption>Magnets</figcaption>
      </figure>
      <figure class="normal">
        <img src="img/pens.png" alt="">
        <figcaption>Pens &amp; Pencils</figcaption>
      </figure>
      <figure class="normal">
        <img src="img/toys.png" alt="">
        <figcaption>Toys</figcaption>
      </figure>
  </main>
图片: Model

Result

1 个答案:

答案 0 :(得分:0)

请尝试下面的代码而不是您正在尝试的代码。

CSS:

figcaption {
            position: absolute;
            width: 100%;
            height: 41px;
            bottom: 0px;
            padding-top: 13px;
            padding-left: 20px;
            font-size: 21.333px;
            font-family: "SegoeUIBold";
            opacity: 0.8;
            background-color: #FFF;
        }

        figure {
            position: relative;
            padding: 5em;
            cursor: pointer;
            float: left;
            margin-right: 10px;
            margin-bottom: 10px;
        }

HTML:

<main>
        <figure>
            <img src="img/greenTshirt.png" alt="">
            <figcaption>T-Shirts</figcaption>
        </figure>
        <figure>
            <img src="img/cards.png" alt="">
            <figcaption>Cards</figcaption>
        </figure>
        <figure>
            <img src="img/pens.png" alt="">
            <figcaption>Pens &amp; Pencils</figcaption>
        </figure>
        <figure>
            <img src="img/notebooks.png" alt="">
            <figcaption>Notebooks</figcaption>
        </figure>
        <figure>
            <img src="img/toys.png" alt="">
            <figcaption>Toys</figcaption>
        </figure>
        <figure>
            <img src="img/bags.png" alt="">
            <figcaption>Bags</figcaption>
        </figure>
        <figure>
            <img src="img/scrum.png" alt="">
            <figcaption>Scrum cards</figcaption>
        </figure>
        <figure>
            <img src="img/magnets.png" alt="">
            <figcaption>Magnets</figcaption>
        </figure>
        <figure>
            <img src="img/redCaps.png" alt="">
            <figcaption>Caps</figcaption>
        </figure>
        <figure>
            <img src="img/magnets.png" alt="">
            <figcaption>Magnets</figcaption>
        </figure>
        <figure>
            <img src="img/pens.png" alt="">
            <figcaption>Pens &amp; Pencils</figcaption>
        </figure>
        <figure>
            <img src="img/toys.png" alt="">
            <figcaption>Toys</figcaption>
        </figure>
    </main>

如果你想增加图像的大小,你可以这样做,然后增加css中的填充。