微信小程序音乐播放器,音乐播放器小程序制作步骤(渲染页面) ... ...

  页面渲染

  

  为了解决这个问题,我们给图片添加一个渐变的遮罩,就像图10-8那样,这样到达文字部分时,背景就变成了黑色,不会影响文字的显示,而且达到了由图片到底下列表颜色渐变的效果,非常美观。

  这个效果主要靠我们的格式文件实现,我们先写我们熟悉的部分。

  1. .list-top {
  2.     position: relative;
  3.     height: 100%;
  4. }
  5. .list-top::after {         
  6.     content: " ";
  7.     display: block;
  8.     padding-top: 100%;
  9. }
  10. .top-info {
  11.     position: absolute;
  12.     bottom: 0;
  13.     width: 100%;
  14.     z-index: 3;
  15. }
  16. .top-img {
  17.     width: 100%;
  18.     height: 100%;
  19.     position: absolute;
  20. }
  21.  
  22. .top-info-inner {
  23.     display: -webkit-box;
  24.     -webkit-box-align: center;
  25.     margin: 0 15px 25px;
  26.     color: #fff;
  27. }
  28.  
  29. .top-info-text {
  30.     -webkit-box-flex: 1;
  31.     margin-right: 10px;
  32. }
  33. .top-info-title {
  34.     font-size: 24px;
  35.     line-height: 36px;
  36.     white-space: nowrap;
  37.     overflow: hidden;
  38. }
  39. .top-info-base {
  40.     font-size: 14px;
  41.     line-height: 20px;
  42. }
复制代码

 

  “::after”表示在“.list-top”后边添加,为了是在不修改布局文件的情况下,添加视图以达到美化的效果。

  

  我们需要添加的遮罩为布局里“top—back”这部分,格式文件为:

  1. .tl-top-b {
  2.     position: absolute;
  3.     bottom: 0;
  4.     width: 100%;
  5.     background-image: -webkit-linear-gradient(top,transparent,currentColor 80%);
  6. }
  7. .tl-top-b::after {
  8.     content: " ";
  9.     display: block;
  10.     padding-top: 60%;
  11. }
复制代码

 

  -webkit-linear-gradient(top,transparent,currentColor 80%)这行代码为我们建立了线性渐变的效果,这样我们的图片底部就会出现渐变为黑色的效果了。<

上一篇 附近的小程序如何添加地址使出现在小程序列表中 下一篇 小程序可以开发游戏吗,官方宣布微信小程序游戏开发教程
论坛资讯同步说明,本文同步自论坛:bbs.miaozhizuo.com,如您在论坛注册成为会员用户并且发帖,则默认论坛文章同步协议,协议内容请移步论坛查看!

          在线客服

            点击这里给我发消息

          VIP咨询
         点击这里给我发消息

          咨询热线

   17080039991

      (免费拨打)

          代理招商

   178-9531-8531

[关闭]
随手APP微信

官方微信自助客服

[关闭]