我遵循了iTunes API的简单教程,并添加了一个选项,可从暗色切换为亮色。但是,每当我切换到深色主题时(当您搜索艺术家时),页面的上半部分才会更改。下半部分仍然是浅色主题。我不确定CSS哪里出问题了。
body {
font-family: 'Montserrat Alternates', sans-serif;
color: #fff;
background-image: linear-gradient(to bottom right, purple, yellow);
background-attachment: fixed;
font-size: 14px;
margin: 0;
padding: 0;
height: 100%;
}
/* Dark/Light Toggle */
section {
position: absolute;
width: 100%;
height: 100vh;
box-sizing: border-box;
background-attachment: fixed;
}
section.dark {
background-image: linear-gradient(to bottom right, black, white);
}
ul {
position: absolute;
top: 20px;
left: 20px;
margin: 0;
padding: 0;
width: 20%;
height: 30px;
z-index: 1;
border: 2px solid #000;
cursor: pointer;
box-sizing: border-box;
overflow: hidden;
}
ul li {
list-style: none;
width: 100%;
height: 60px;
text-align: center;
text-transform: uppercase;
transition: 0.5s;
}
ul.active li {
transform: translateY(-30px);
background: #262626;
}
ul li span{
display: block;
height: 30px;
width: 100%;
line-height: 30px;
color: #fff;
}
ul li span:nth-child(1) {
color: #fff;
}