背景图像css顶部和底部的透明渐变

背景图像css顶部和底部的透明渐变,css,linear-gradients,gradient,Css,Linear Gradients,Gradient,是否可以在背景图像的顶部和底部放置透明渐变?目前,我只能在一个或另一个地方找到它 更新: 尝试在应用背景图像的区域放置2,然后使用两个类(一个相反,另一个)尝试创建所需的效果,但效果不太好。如果可能的话,我也希望它不会影响任何其他内容,并且它在应用的部分中的位置 CSS HTML(基本) 在这里输入代码 正文 更多文本 像这样的东西 JSFIDLE CSS 由生成的渐变中可以有多个停止点,因此,如果希望顶部10%渐变为透明,底部10%渐变回透明,可以执行以下操作: background-im

是否可以在背景图像的顶部和底部放置透明渐变?目前,我只能在一个或另一个地方找到它

更新:

尝试在应用背景图像的区域放置2,然后使用两个类(一个相反,另一个)尝试创建所需的效果,但效果不太好。如果可能的话,我也希望它不会影响任何其他内容,并且它在应用的部分中的位置

CSS

HTML(基本)


在这里输入代码
正文

更多文本

像这样的东西

JSFIDLE

CSS

生成的渐变中可以有多个停止点,因此,如果希望顶部10%渐变为透明,底部10%渐变回透明,可以执行以下操作:

background-image: linear-gradient(
    to bottom,
    rgba(64, 64, 64, 1) 0%,
    rgba(64, 64, 64, 0) 10%,
    rgba(64, 64, 64, 0) 90%,
    rgba(64, 64, 64, 1) 100%
);
标签的演示:或不带额外的


css背景图片演示:

是的,只需添加更多的站点。你能展示你的尝试吗?(你的代码在哪里?@xec我已经更新了问题以包含代码!快速警告:这在IE 9及以下版本中不起作用。
<div id="photo-place-holder">
    <div class="picture-gradient2"></div>

    enter code here

    <div>
        <p>Text</p>
        <p>More Text</p>
    </div>

    <div id="search-bar2">
        <form class="form-wrapper2 searchbar2">
            <table id="search-table" cellpadding="0" cellspacing="0">
                <tr>
                    <td><input type="text" placeholder="Search for activities and places" required /></td>
                    <td><button type="submit"><img src="Logos/search_white_48px.png" height="28px" width="28px" /></button></td>
                </tr>
            </table>
        </form>
    </div>

    <div id="search-categories"></div>
    <div id="photo-details"></div>
    <div class="picture-gradient2"></div>
</div>
background: -moz-linear-gradient(top,  rgba(255,255,255,0) 0%, rgba(41,137,216,1) 50%, rgba(125,185,232,0) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0)), color-stop(50%,rgba(41,137,216,1)), color-stop(100%,rgba(125,185,232,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top,  rgba(255,255,255,0) 0%,rgba(41,137,216,1) 50%,rgba(125,185,232,0) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top,  rgba(255,255,255,0) 0%,rgba(41,137,216,1) 50%,rgba(125,185,232,0) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top,  rgba(255,255,255,0) 0%,rgba(41,137,216,1) 50%,rgba(125,185,232,0) 100%); /* IE10+ */
background: linear-gradient(to bottom,  rgba(255,255,255,0) 0%,rgba(41,137,216,1) 50%,rgba(125,185,232,0) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#007db9e8',GradientType=0 ); /* IE6-9 */
background-image: linear-gradient(
    to bottom,
    rgba(64, 64, 64, 1) 0%,
    rgba(64, 64, 64, 0) 10%,
    rgba(64, 64, 64, 0) 90%,
    rgba(64, 64, 64, 1) 100%
);