产品网格,物品高度不同

时间:2014-02-25 07:31:07

标签: html css css3

你好我正在研究一个简单的产品网格,目前仅用于测试它不是最终设计或者其他东西而且我有高度问题如果我有两行文本布局中断并且我有不知道如何修复它谷歌搜索但没有找到任何第一次我认为这是因为图片。 实例:http://jsfiddle.net/pp6L8/9/

HTML:

<section class="shop-grid">
  <div class="container">
    <section class="col-group">
      <article class="col-3">
      <div class="item-container ">
        <figure>
          <div class="container-thumb-screen"><span class="thumb-screen"></span></div>
            <img src="http://www.scribant.ro/admin/cms_catalog/catalog_images/category_324/products/4654.jpg" alt=""></a>
              <figcaption class="product-name">
                <h2><a href="">Product Name</a></h2>
              </figcaption>
          </figure>
          <div class="item-actions">
              <a href="" alt="" class="button"><i class="icon-heart"></i></a>
              <a href="" alt="" class="button"><i class="icon-shopping-cart"></i></a>
              <a href="" alt="" class="button"><i class="icon-double-angle-right"></i></a>
          </div>
      </div>
      </article>
      <article class="col-3">
      <div class="item-container ">
        <figure>
          <div class="container-thumb-screen"><span class="thumb-screen"></span></div>
            <img src="http://www.scribant.ro/admin/cms_catalog/catalog_images/category_324/products/4654.jpg" alt=""></a>
              <figcaption class="product-name">
                <h2><a href="">Product Name</a></h2>
              </figcaption>
          </figure>
          <div class="item-actions">
              <a href="" alt="" class="button"><i class="icon-heart"></i></a>
              <a href="" alt="" class="button"><i class="icon-shopping-cart"></i></a>
              <a href="" alt="" class="button"><i class="icon-double-angle-right"></i></a>
          </div>
      </div>
      </article>
      <article class="col-3">
      <div class="item-container ">
        <figure>
          <div class="container-thumb-screen"><span class="thumb-screen"></span></div>
            <img src="http://www.scribant.ro/admin/cms_catalog/catalog_images/category_324/products/4654.jpg" alt=""></a>
              <figcaption class="product-name">
                <h2><a href="">Product Name</a></h2>
              </figcaption>
          </figure>
          <div class="item-actions">
              <a href="" alt="" class="button"><i class="icon-heart"></i></a>
              <a href="" alt="" class="button"><i class="icon-shopping-cart"></i></a>
              <a href="" alt="" class="button"><i class="icon-double-angle-right"></i></a>
          </div>
      </div>
      </article>
      <article class="col-3">
      <div class="item-container ">
        <figure>
          <div class="container-thumb-screen"><span class="thumb-screen"></span></div>
            <img src="http://www.scribant.ro/admin/cms_catalog/catalog_images/category_324/products/4654.jpg" alt=""></a>
              <figcaption class="product-name">
                <h2><a href="">Biblioraft Plastifiat Globox Cotor 75Mm</a></h2>
              </figcaption>
          </figure>
          <div class="item-actions">
              <a href="" alt="" class="button"><i class="icon-heart"></i></a>
              <a href="" alt="" class="button"><i class="icon-shopping-cart"></i></a>
              <a href="" alt="" class="button"><i class="icon-double-angle-right"></i></a>
          </div>
      </div>
      </article>
      </section>
    <section class="col-group">
      <article class="col-3">
      <div class="item-container">
        <figure>
          <div class="container-thumb-screen"><span class="thumb-screen"></span></div>
            <img src="http://www.scribant.ro/admin/cms_catalog/catalog_images/category_324/products/4654.jpg" alt=""></a>
              <figcaption class="product-name">
                <h2><a href="">Product Name</a></h2>
              </figcaption>
          </figure>
          <div class="item-actions">
              <a href="" alt="" class="button"><i class="icon-heart"></i></a>
              <a href="" alt="" class="button"><i class="icon-shopping-cart"></i></a>
              <a href="" alt="" class="button"><i class="icon-double-angle-right"></i></a>
          </div>
      </div>
      </article>
      <article class="col-3">
      <div class="item-container">
        <figure>
          <div class="container-thumb-screen"><span class="thumb-screen"></span></div>
            <img src="http://www.scribant.ro/admin/cms_catalog/catalog_images/category_324/products/4654.jpg" alt=""></a>
              <figcaption class="product-name">
                <h2><a href="">Product Name</a></h2>
              </figcaption>
          </figure>
          <div class="item-actions">
              <a href="" alt="" class="button"><i class="icon-heart"></i></a>
              <a href="" alt="" class="button"><i class="icon-shopping-cart"></i></a>
              <a href="" alt="" class="button"><i class="icon-double-angle-right"></i></a>
          </div>
      </div>
      </article>
      <article class="col-3">
      <div class="item-container">
        <figure>
          <div class="container-thumb-screen"><span class="thumb-screen"></span></div>
            <img src="http://www.scribant.ro/admin/cms_catalog/catalog_images/category_324/products/4654.jpg" alt=""></a>
              <figcaption class="product-name">
                <h2><a href="">Product Name</a></h2>
              </figcaption>
          </figure>
          <div class="item-actions">
              <a href="" alt="" class="button"><i class="icon-heart"></i></a>
              <a href="" alt="" class="button"><i class="icon-shopping-cart"></i></a>
              <a href="" alt="" class="button"><i class="icon-double-angle-right"></i></a>
          </div>
      </div>
      </article>
      <article class="col-3">
      <div class="item-container">
        <figure>
          <div class="container-thumb-screen"><span class="thumb-screen"></span></div>
            <img src="http://www.scribant.ro/admin/cms_catalog/catalog_images/category_324/products/4654.jpg" alt=""></a>
              <figcaption class="product-name">
                <h2><a href="">Product Name</a></h2>
              </figcaption>
          </figure>
          <div class="item-actions">
              <a href="" alt="" class="button"><i class="icon-heart"></i></a>
              <a href="" alt="" class="button"><i class="icon-shopping-cart"></i></a>
              <a href="" alt="" class="button"><i class="icon-double-angle-right"></i></a>
          </div>
      </div>
      </article>
      </section>

CSS:

body {
    font-family: 'Open Sans', sans-serif;
    font-weight: normal;
}
.product-name {
    margin: 20px 0;
    padding: 0;
}
.product-name a {
    color: inherit;
    display: block;
    font-size: 14px;
    font-weight: normal;
    font-family: 'Open Sans', sans-serif;
    font-weight: normal;
    padding: 0;
    text-align: center;
    text-decoration: none;
}
.shop-grid img {
    max-width: 258px;
    max-height: 258px;
}
.shop-grid .item-container {
    background: none repeat scroll 0 0 #FFFFFF;
    border: 1px solid #EBEBEB;
    float: left;
    position: relative;
    transition: all 1s ease 0s;
}
.shop-grid .item-actions {
    padding: 10px 20px 0;
    text-align: center;
}
.shop-grid .item-actions a {
    border: 1px solid #E1E1E1;
    cursor: pointer;
    display: inline-block;
    margin: 0;
    text-align: left;
    max-width: none;
    padding: 10px 5px 5px 10px;
    position: relative;
    text-align: center;
    top: 1px;
    transition: all 0.2s ease 0s;
    z-index: 100;
}
.shop-grid .item-actions a [class^="icon-"], a [class*=" icon-"] {
    display: inline-block;
    font-size: 18px;
    text-align: center;
    line-height: 1.5;
    padding-left: 9px;
    padding-right: 9px;
}
.button {
    background: transparent;
    color: #555555;
}
.button:hover {
    background: #1695A3;
    color: #fff;
}
.col-group {
    padding-top: 16px;
    padding-bottom: 16px;
}

1 个答案:

答案 0 :(得分:-1)

请替换此CSS ...

.product-name {
    height: 30px;
    margin-bottom: 20px;
    margin-left: 0;
    margin-right: 0;
    margin-top: 20px;
    padding-bottom: 0;
    padding-left: 0;
    padding-right: 0;
    padding-top: 0;
}