网页前端 好看的手机版音乐应用模板

这篇文章最后更新于06-06 16:45前,您需要注意相关的内容是否还可用,如有疑问请联系作者!

请输入图片描述
html代码

<script src="https://unpkg.com/akar-icons-fonts"></script>
<div class="phone">
    <header class="header">
        <div class="header-logo">
            <div>
                <span></span>
                <span></span>
                <span></span>
                <span></span>
            </div>
        </div>
        <div class="header-title">
            Home
        </div>
        <div class="header-buttons">
            <button class="notifications">
                <i class="ai-bell"></i>
            </button>
            <button class="avatar">
<img src="https://images.unsplash.com/photo-1653691040409-793d2c22ed69?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=687&q=80" />
            </button>
        </div>
    </header>
    <section class="title">
        <h1>Listening Everyday</h1>
        <p>Explore millions of music according to your taste</p>
    </section>
    <section class="search">
        <div class="search-inner">
            <button class="search-button">
                <i class="ai-search"></i>
            </button>
            <input type="text" class="search-input" placeholder="Search Music" />

        </div>
    </section>

    <nav class="navigation">
        <a href="#" class="navigation-item active">Overview</a>
        <a href="#" class="navigation-item">Songs</a>
        <a href="#" class="navigation-item">Albums</a>
        <a href="#" class="navigation-item">Artists</a>
    </nav>
    <section class="playlists">

        <article class="card">
            <div class="card-inner">
                <span class="card-pin"></span>
                <div class="card-image">
                    <img src="https://images.unsplash.com/photo-1516280440614-37939bbacd81?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80" />
                </div>
                <div class="card-content">
                    <div class="card-meta">
                        <span class="card-meta-number">20 songs</span>
                        <button class="card-meta-button">
                            <i class="ai-circle-triangle-right-fill"></i>
                        </button>
                    </div>
                    <h2 class="card-title">Alan Walker</h2>
                </div>
            </div>
        </article>

        <article class="card">
            <div class="card-inner">
                <span class="card-pin"></span>
                <div class="card-image">
                    <img src="https://images.unsplash.com/photo-1462965326201-d02e4f455804?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80" />
                </div>
                <div class="card-content">
                    <div class="card-meta">
                        <span class="card-meta-number">20 songs</span>
                        <button class="card-meta-button">
                            <i class="ai-circle-triangle-right-fill"></i>
                        </button>
                    </div>
                    <h2 class="card-title">Tim Bergling</h2>
                </div>
            </div>
        </article>
    </section>
    <section class="currently-playing">

        <article class="card horizontal">
            <div class="card-inner">
                <span class="card-pin simple"></span>
                <div class="card-image">
                    <img src="https://images.unsplash.com/photo-1471478331149-c72f17e33c73?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1469&q=80" />
                </div>
                <div class="card-content">
                    <div class="card-meta">
                        <span class="card-meta-artist">Marshmello</span>
                        <button class="card-meta-button" style="opacity: 0;">
                            <i class="ai-circle-triangle-right-fill"></i>
                        </button>
                    </div>
                    <h2 class="card-title">Hate the Other Side
                        <span class="card-time">3:40</span>
                    </h2>
                </div>
                <span class="card-pin simple"></span>
            </div>
        </article>
    </section>
    <footer class="menu">
        <div class="menu-inner">
            <a href="#" class="menu-item active">
                <i class="ai-home"></i>
            </a>
            <a href="#" class="menu-item">
                <i class="ai-heart"></i>
            </a>
            <a href="#" class="menu-item">
                <i class="ai-fire"></i>
            </a>
            <a href="#" class="menu-item">
                <i class="ai-gear"></i>
            </a>
        </div>
    </footer>
</div

css样式

@import url("https://fonts.googleapis.com/css2?family=Urbanist:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
*,
*:after,
*:before {
  box-sizing: border-box;
}

:root {
  --c-gray-100: #fbf8f2;
  --c-gray-200: #fcfdfe;
  --c-gray-300: #e9ebec;
  --c-gray-400: #e3e4ea;
  --c-gray-500: #5f5f5f;
  --c-gray-900: #1d1d1d;
  --c-blue-300: #a8dee2;
  --c-blue-500: #2ab3c0;
  --c-green-500: #80b895;
  --c-green-300: #bad5ca;
  --c-red-500: #ea605e;
  --c-yellow-300: #f8e0b1;
  --c-yellow-500: #f9bc73;
  --rotation: -3deg;
}

body {
  font-family: "Urbanist", sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  padding-top: 5vw;
  padding-bottom: 5vw;
  background-color: #1f1f1f;
}

img {
  display: block;
  max-width: 100%;
}

input,
button {
  font: inherit;
}

.phone {
  width: 460px;
  border-radius: 25px;
  overflow: hidden;
  padding: 2rem;
  box-shadow: 0 0 0 10px var(--c-gray-300), 0 0 0 11px var(--c-gray-200);
  background-color: #fff;
  position: relative;
  z-index: 1;
  margin-left: auto;
  margin-right: auto;
}

.header {
  display: grid;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  grid-template-columns: 1fr 2fr 1fr;
}

.header-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 48px;
  height: 48px;
  background-color: var(--c-blue-300);
  border: 2px solid var(--c-gray-900);
  border-radius: 15px;
}
.header-logo div {
  display: flex;
  flex-wrap: wrap;
  width: 24px;
  height: 24px;
}
.header-logo span {
  display: block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--c-gray-900);
  background-color: var(--c-yellow-500);
  border-radius: 50%;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-left: auto;
  margin-right: auto;
}

.header-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.notifications {
  padding: 0;
  border: 0;
  background-color: transparent;
  margin-right: 1rem;
  position: relative;
  transform-origin: center center;
  transition: 0.15s ease;
  cursor: pointer;
}
.notifications:hover, .notifications:focus {
  transform: rotate(10deg);
}
.notifications i {
  font-size: 1.75rem;
  color: #454545;
}
.notifications:after {
  right: -8px;
  top: 3px;
  content: "2";
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  width: 20px;
  height: 20px;
  font-size: 0.75rem;
  background-color: var(--c-red-500);
  border-radius: 50%;
  font-weight: 800;
  border: 2px solid var(--c-gray-900);
}

.avatar {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 15px;
  overflow: hidden;
  border: 3px solid #fff;
  box-shadow: 0 8px 10px -4px rgba(0, 0, 0, 0.2);
  transform-origin: center center;
  transition: 0.15s ease;
  cursor: pointer;
}
.avatar:hover, .avatar:focus {
  transform: translatey(-4px);
  box-shadow: 0 12px 14px -4px rgba(0, 0, 0, 0.3);
}

.title {
  margin-top: 1rem;
}
.title h1 {
  font-size: 1.5rem;
  font-weight: 700;
}
.title p {
  font-size: 1rem;
  color: var(--c-gray-500);
  margin-top: 0.375em;
}

.search {
  position: relative;
  z-index: 1;
  transition: 0.15s ease;
}
.search:hover, .search:focus-within {
  transform: translatey(-2px);
}

.search-inner {
  display: flex;
  align-items: center;
  border: 2px solid var(--c-gray-900);
  border-radius: 15px;
  height: 60px;
  font-size: 1rem;
  width: 100%;
  background-color: #fff;
  position: relative;
  margin-top: 2rem;
}
.search-inner:after {
  content: "";
  display: block;
  position: absolute;
  z-index: -1;
  width: 96%;
  height: 100%;
  bottom: -9px;
  left: calc(50% - 48%);
  border-radius: 20px;
  border: 2px solid var(--c-gray-900);
  background-color: var(--c-gray-100);
  transition: 0.15s ease;
}
.search-inner:hover input::-moz-placeholder, .search-inner:focus-within input::-moz-placeholder {
  color: #787878;
}
.search-inner:hover input:-ms-input-placeholder, .search-inner:focus-within input:-ms-input-placeholder {
  color: #787878;
}
.search-inner:hover input::placeholder, .search-inner:focus-within input::placeholder {
  color: #787878;
}
.search-inner:hover:after, .search-inner:focus-within:after {
  transform: translatey(2px);
}

.search-button {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px 0 0 15px;
  border: 0;
  background-color: var(--c-gray-100);
  position: relative;
  height: 100%;
  border-right: 2px solid var(--c-gray-900);
  width: 70px;
  transition: 0.15s ease;
  cursor: pointer;
}
.search-button i {
  font-size: 1.25em;
}
.search-button:focus, .search-button:hover {
  background-color: var(--c-yellow-300);
  outline: 0;
}

.search-input {
  border: 0;
  border-radius: 0 15px 15px 0;
  height: 100%;
  background-color: #fff;
  width: 100%;
  padding-left: 1em;
  padding-right: 1em;
}
.search-input:focus {
  outline: 0;
}
.search-input::-moz-placeholder {
  font-weight: 600;
  color: var(--c-gray-900);
  -moz-transition: 0.15s ease;
  transition: 0.15s ease;
}
.search-input:-ms-input-placeholder {
  font-weight: 600;
  color: var(--c-gray-900);
  -ms-transition: 0.15s ease;
  transition: 0.15s ease;
}
.search-input::placeholder {
  font-weight: 600;
  color: var(--c-gray-900);
  transition: 0.15s ease;
}

.navigation {
  margin-top: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--c-gray-900);
  display: flex;
  justify-content: space-between;
}

.navigation-item {
  font-size: 1.125rem;
  display: inline-block;
  padding: 0 0.5rem;
  text-decoration: none;
  color: inherit;
  position: relative;
  z-index: 1;
  font-weight: 500;
}
.navigation-item.active {
  font-weight: 800;
}
.navigation-item.active:before {
  background-color: var(--c-yellow-500);
}
.navigation-item:before {
  content: "";
  display: block;
  position: absolute;
  width: 100%;
  height: 14px;
  background-color: transparent;
  z-index: -1;
  bottom: -2px;
  left: 0;
  transition: 0.15s ease;
}
.navigation-item + .navigation-item {
  margin-left: 1.25rem;
}
.navigation-item:hover:before, .navigation-item:focus {
  background-color: var(--c-yellow-500);
}

.playlists {
  margin-top: 1.5rem;
  display: flex;
  padding: 2rem 0.5rem;
}

.currently-playing {
  padding: 1rem 0.5rem;
}

.card {
  width: 200px;
  transform: rotate(var(--rotation));
  transition: 0.15s ease-out;
}
.card:nth-child(2) {
  margin-top: 1rem;
  --rotation: 5deg;
}
.card:nth-child(2) .card-inner:after {
  background-color: var(--c-green-300);
}
.card:nth-child(2) .card-pin {
  top: 20px;
  left: 20px;
  transform: rotate(-5deg);
}
.card + .card {
  margin-left: 2rem;
}
.card:hover, .card:focus-within {
  transform: translateY(4px) rotate(var(--rotation));
}
.card:hover .card-inner, .card:focus-within .card-inner {
  background-color: var(--c-gray-100);
}
.card:hover .card-pin:after, .card:focus-within .card-pin:after {
  height: 54px;
}
.card:hover .card-pin:before, .card:focus-within .card-pin:before {
  transform: translatey(-4px);
}
.card.horizontal {
  width: 100%;
  transform: rotate(3deg);
}
.card.horizontal .card-inner {
  flex-direction: row;
  align-items: center;
  padding: 1rem;
}
.card.horizontal .card-inner:after {
  background-color: var(--c-green-500);
}
.card.horizontal .card-image {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}
.card.horizontal .card-content {
  width: 100%;
  margin-top: 0;
  margin-left: 0.5rem;
}
.card.horizontal .card-meta-artist {
  font-weight: 700;
}
.card.horizontal .card-title {
  font-weight: 500;
  color: var(--c-gray-500);
  font-size: 1.125em;
  margin-top: 0.125em;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}
.card.horizontal .card-time {
  font-weight: 600;
}
.card.horizontal:hover .card-pin.simple:before,
.card.horizontal:hover .card-pin.simple:after, .card.horizontal:focus-within .card-pin.simple:before,
.card.horizontal:focus-within .card-pin.simple:after {
  transform: none;
}
.card.horizontal:hover .card-pin.simple:after, .card.horizontal:focus-within .card-pin.simple:after {
  height: 50px;
}

.card-inner {
  display: flex;
  flex-direction: column;
  border: 2px solid var(--c-gray-900);
  border-radius: 20px;
  padding: 0.5rem;
  background-color: #fff;
  position: relative;
}
.card-inner:after {
  content: "";
  display: block;
  position: absolute;
  z-index: -1;
  width: 95%;
  height: 100%;
  bottom: -9px;
  left: calc(50% - 47.5%);
  border-radius: 20px;
  border: 2px solid var(--c-gray-900);
  background-color: var(--c-yellow-300);
}

.card-pin {
  width: 12px;
  height: 12px;
  background-color: var(--c-gray-900);
  position: absolute;
  top: 20px;
  left: calc(50% - 6px);
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--c-gray-900);
  transform: rotate(3deg);
  z-index: 1;
}
.card-pin:before, .card-pin:after {
  content: "";
  display: block;
  border-radius: 50%;
  position: absolute;
  transition: 0.15s ease-out;
}
.card-pin:before {
  width: 12px;
  height: 12px;
  background-color: var(--c-gray-900);
  border-radius: 50%;
  left: calc(50% - 6px);
  top: -44px;
}
.card-pin:after {
  width: 6px;
  background-color: #fff;
  border: 1px solid;
  border-radius: 99em;
  height: 50px;
  left: calc(50% - 3px);
  bottom: 3px;
}
.card-pin.simple {
  box-shadow: none;
}
.card-pin.simple:nth-of-type(odd) {
  left: 10px;
  top: 10px;
  transform: rotate(-45deg);
}
.card-pin.simple:nth-of-type(even) {
  left: calc(100% - 20px);
  top: calc(100% - 20px);
  transform: rotate(120deg);
}

.card-image {
  border-radius: 15px;
  overflow: hidden;
  aspect-ratio: 4/3;
  position: relative;
}
.card-image img {
  width: 100%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.card-meta,
.card-title {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.card-meta {
  padding-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-meta-number {
  color: var(--c-gray-500);
  font-size: 0.875rem;
  font-weight: 500;
}

.card-meta-button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: var(--c-gray-900);
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
  line-height: 0;
  border-radius: 50%;
  background-color: transparent;
}
.card-meta-button i {
  font-size: 1.75rem;
}
.card-meta-button:after {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.card-title {
  margin-top: 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  padding-bottom: 0.5rem;
}

.menu-inner {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  border-radius: 15px;
  border: 2px solid var(--c-gray-900);
  justify-content: space-between;
  padding: 0.75rem;
  background-color: var(--c-blue-500);
  position: relative;
}
.menu-inner:after {
  content: "";
  display: block;
  position: absolute;
  z-index: -1;
  width: 95%;
  height: 100%;
  bottom: -9px;
  left: calc(50% - 47.5%);
  border-radius: 20px;
  border: 2px solid var(--c-gray-900);
  background-color: var(--c-gray-100);
}

.menu-item {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  color: #fff;
  width: 80px;
  border-radius: 15px;
  padding-top: 0.375rem;
  padding-bottom: 0.375rem;
  text-decoration: none;
  background-color: transparent;
  border: 2px solid transparent;
}
.menu-item:hover, .menu-item:focus, .menu-item.active {
  border-color: var(--c-gray-900);
  background-color: var(--c-yellow-500);
  color: var(--c-gray-900);
}

*,
*:focus {
  outline: 0;
}

转载于:https://www.jq22.com/code4445

标签: 模板 css html 音乐
0 评论 打赏
最后编辑于:2022 年 06 月 06 日

网友评论 0 评论

评论空空如也,快来评论吧!