如何应用背景渐变样式 css



我想像这样应用裸地渐变样式 -> http://nimb.ws/Xq79Uw

以下是 HTML 代码:

<div class="featured-title zl-artful-featured-title">
   <aside class="post-meta cf">
      <a aria-label="Artful Interiors" class="cat-artful-interiors" href="http://localhost/magnifissance/?cat=86">Artful Interiors</a>                                          
   </aside>
   <div class="row">
      <div class="columns medium-10">
         <div class="post-title zl-artful-interi-title">
            <a href="http://localhost/magnifissance/?p=12466">Enrico Fratesi Shares His Vision of Form, Tradition and Renewal</a>
         </div>
      </div>
      <div class="columns medium-2">
         <figure class="post-gallery "></figure>
      </div>
   </div>
</div>

任何人都对这种类型风格有想法,那么请更新我。

谢谢。

在您的

示例中,渐变似乎位于图像的顶部。这个使用伪元素的代码将为你做到这一点,而不是将梯度代码放在div 本身上。

#artful_interiors .post > a {
    position: relative;
}
#artful_interiors .post > a:before {
    content: " ";
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient( to bottom, rgba(0,0,0,0) 50%, #000 95% );
}

#zl-artful-featured-title{
   background: linear-gradient(
    to top,
    #63B4C9  35%,
    #FFFFFF 70%
  );
  background-repeat: no-repeat;
  height:260px;
  width:100%;
}
<div id="zl-artful-featured-title">
    <p>Content</p>
    <img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTvbOaFeLuR9IUkcut98bJs4r7-Qm8AGcEEYiiKxiAZEiljvUS_"/>
</div>

试试这个

#zl-artful-featured-title{
  background-image: -webkit-linear-gradient(90deg, #63B4C9 35%, #FFFFFF 40%);
}

如果不起作用,请尝试此操作

 #zl-artful-featured-title{
  background: linear-gradient(
    to bottom,
    #63B4C9  35%,
    #FFFFFF 70%
  );
}

确保已将 # 更改为 . (如果使用类(。我希望它有所帮助

相关内容

  • 没有找到相关文章

最新更新