将3个不同的按钮添加到半透明区域

时间:2013-12-17 16:27:37

标签: html css opacity

我需要帮助

  1. 如何在半透明区域(<figcaption>)内添加两个图像按钮,并且所有3个按钮在半透明区域内垂直居中并均匀分布?

  2. 我添加的按钮似乎是半透明的(与<figcaption>不透明度相同)。我需要按钮为opacity:1;

  3. 这是代码:

    <div class="container demo-2">
    <ul class="grid cs-style-2">
    <li>
    <figure>
    <gt_descA>Chair</gt_descA>
    <gt_descC>$87.34</gt_descC>
    <img src="imagez/designs/thumbs/0/01.jpg" alt="img02">
    <figcaption>
    <a href="index.html" onClick=""><span class="hint  hint--top  hint--rounded" data-hint="Zoom Image"><img src="additional/buttons/bu_zoom.jpg"></img></span></a>
    </figcaption>
    </figure>
    </li>
    </ul>
    </div>
    

    CSS

    .grid {
        padding: 70px 20px 100px 20px;
        max-width: 1300px;
        margin: 0 auto;
        list-style: none;
        text-align: center;
    }
    
    .grid li {
        display: inline-block;
        width: 234px;
        margin: 0;
        padding: 20px;
        text-align: left;
        position: relative;
    }
    
    .grid figure {
        margin: 0;
        position: relative;
    }
    
    .grid figure img {
        max-width: 100%;
        display: block;
        position: relative;
    }
    
    .grid figcaption {
        position: absolute;
        top: 0;
        left: 0;
        padding: 20px;
        background: #000;
        color: #ed4e6e;
        opacity:0;
    }
    
    /*button*/
    .grid figcaption a {
        display: inline-block;
    }
    
    /* Caption Style*/
    .cs-style-2 figure figcaption {
        z-index: 10;
        -webkit-transition: -webkit-transform 0.4s;
        -moz-transition: -moz-transform 0.4s;
        transition: transform 0.4s;
    }
    
    .no-touch .cs-style-2 figure:hover figcaption,
    .cs-style-2 figure.cs-hover figcaption {
        -webkit-transform: translateY(0px);
        -moz-transform: translateY(0px);
        -ms-transform: translateY(0px);
        transform: translateY(0px);
        opacity:0.6;
    }
    
    .cs-style-2 figcaption {
        height: 24px;
        width: 187px;
        top: auto;
        bottom: 0px;
    }
    
    .cs-style-2 figcaption a {
        position: absolute;
        right: 20px;
        top: 30px;
    }
    
    @media screen and (max-width: 31.5em) {
        .grid {
            padding: 10px 10px 100px 10px;
        }
        .grid li {
            width: 100%;
            min-width: 234px;
        }
    }
    

1 个答案:

答案 0 :(得分:0)

您可以添加按钮,并使用

对齐它们
container {
  text-align: center;
}

或者这个:

container {
  max-width: someval;
  margin: 0 auto; // no vertical, auto horizontal
}

并且alpha过滤器(不透明度)也被添加到子元素中!尝试为它们设定价值;分开..