首页 > 其他分享 >freeCodeCamp_创建一架钢琴

freeCodeCamp_创建一架钢琴

时间:2022-11-22 17:15:18浏览次数:56  
标签:3px background color 钢琴 width 一架 freeCodeCamp position border

点击查看代码
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Piano</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="./styles.css">
  </head>
  <body>
    <div id="piano">
      <img class="logo" src="https://cdn.freecodecamp.org/platform/universal/fcc_primary.svg" alt="freeCodeCamp Logo" />
      <div class="keys">
        <div class="key"></div>
        <div class="key black--key"></div>
        <div class="key black--key"></div>
        <div class="key"></div>
        <div class="key black--key"></div>
        <div class="key black--key"></div>
        <div class="key black--key"></div>

        <div class="key"></div>
        <div class="key black--key"></div>
        <div class="key black--key"></div>
        <div class="key"></div>
        <div class="key black--key"></div>
        <div class="key black--key"></div>
        <div class="key black--key"></div>

        <div class="key"></div>
        <div class="key black--key"></div>
        <div class="key black--key"></div>
        <div class="key"></div>
        <div class="key black--key"></div>
        <div class="key black--key"></div>
        <div class="key black--key"></div>
      </div>
    </div>
  </body>
</html>
CSS部分如下:
点击查看代码
html {
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

#piano {
  background-color: #00471b;
  width: 992px;
  height: 290px;
  margin: 80px auto;
  padding: 90px 20px 0 20px;
  position: relative;
  border-radius: 10px;
}

.keys {
  background-color: #040404;
  width: 949px;
  height: 180px;
  padding-left: 2px;
  overflow: hidden;
}

.key {
  background-color: #ffffff;
  position: relative;
  width: 41px;
  height: 175px;
  margin: 2px;
  float: left;
  border-radius: 0 0 3px 3px;
}

.key.black--key::after {
  background-color: #1d1e22;
  content: "";
  position: absolute;
  left: -18px;
  width: 32px;
  height: 100px;
  border-radius: 0 0 3px 3px;
}

.logo {
  width: 200px;
  position: absolute;
  top: 23px;
}

@media (max-width: 768px) {
  #piano {
    width: 358px;
  }

  .keys {
    width: 318px;
  }

  .logo {
    width: 150px;
  }
}

@media (max-width: 1199px) and (min-width: 769px) {
  #piano{
    width:675px;
  }
  .keys{
    width:633px;
  }

}

标签:3px,background,color,钢琴,width,一架,freeCodeCamp,position,border
From: https://www.cnblogs.com/zizz/p/16915713.html

相关文章

  • freeCodecamp_认证项目_调查表单
    点击查看代码<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="view......
  • freecodeCamp_咖啡店菜单
    点击查看代码<!DOCTYPEhtml><htmllang="en"><head><metacharset="utf-8"/><metaname="viewport"content="width=device-width,initial-scale=1.0"......
  • freecodeCamp_构建一组彩色标记
    点击查看代码<!DOCTYPEhtml><htmllang="en"><head><metacharset="utf-8"><metaname="viewport"content="width=device-width,initial-scale=1.0">......
  • freecodeCamp_注册表单
    点击查看代码<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>RegistrationForm</title><linkrel="stylesheet"href="styles......
  • freecodecamp_猫咪相册应用
    点击查看代码<!DOCTYPEhtml><htmllang="en"><head><title>CatPhotoApp</title><metacharset="UTF-8"></head><body><main><h1>......
  • 彻底搞懂钢琴的调式
    目录前言平均展开黑白键C大调升记号大调G大调D大调A大调E大调B大调#F大调#C大调降记号大调F大调bB大调bE大调bA大调bD大调bG大调bC大调前言钢琴键盘是标准的十二平均律,黑......
  • 钢琴家刷屏器
     1#NoEnv2SetBatchLines-13ListLinesOff45;强制以ANSI版本管理员权限运行6runwith("admin")78IniRead,con,myfile.ini,Count,c......
  • FreeCodeCamp : 标题案例一个句子
    FreeCodeCamp:标题案例一个句子来自JavaScript中的基本算法脚本列表。freecodecamp—logo在这篇文章,我想分享我的解决方案FreeCodeCamp问题“TileCaseaSe......