Web实现:网易云音乐个人推荐页

78 篇文章 2 订阅
68 篇文章 0 订阅

background-position: center;/背景图居中/
background-position: bottom right;/背景图右下角/
background-size: contain;/把背景图片扩大至最大尺寸,使其宽度和高度完全适应内容区域/
background-size: cover;/把背景图像扩展至足够大,以使背景图像完全覆盖背景区域。背景图像的某些部分也许无法显示在背景定位区域中。/

实现效果如下:
个人推荐页
HTML部分:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <link rel="stylesheet" type="text/css" href="./index.css" />
    <title>每日推荐</title>
  </head>
  <body>
    <div class="banner">
      <div class="box">
        <div class="head">星期二</div>
        <div class="date">17</div>
        <div class="mask"></div>
      </div>
    </div>
  </body>
</html>

CSS部分:

.banner {
  background-image: url(https://document.youkeda.com/P3-1-HTML-CSS/1.9/music-bg.jpg);
  background-size: cover;
  padding-left: 48px;
  padding-top: 30px;
  box-sizing: border-box;
  width: 715px;
  height: 200px;
}

.box {
  position: relative;
  width: 140px;
  height: 140px;
  border-radius: 4px;
  overflow: hidden;
}

.head {
  height: 33px;
  line-height: 33px;
  color: #fed9d9;
  font-size: 14px;
  text-align: center;
  background: linear-gradient(to bottom, #d94747, #b9191a);
}

.date {
  background-color: white;
  height: 107px;
  line-height: 107px;
  text-align: center;
  font-size: 94px;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: bold;
  color: #202020;
}

.mask {
  position: absolute;
  top: 33px;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.05),
    rgba(0, 0, 0, 0.15) 50%,
    rgba(0, 0, 0, 0.05) 50%,
    rgba(0, 0, 0, 0.15) 100%
  );
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

jasmyn518

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值