我正在使用api构建一个电影网站。
当我链接css样式时,似乎什么都不起作用。甚至连背景色都没有。此外,我还试图添加flex,其中一个是不起作用的。链接中有什么问题吗?
这是我在这个网站上的第一个问题,我还在学习html和css。
@import url('https://googleapis.com/css2?family=Poppins:wght@200;400&display=swap');
:root {
--primary-color;
#22254b;
--secondary-color;
#373b69;
}
* {
box-sizing: border-box;
}
body {
background-color: purple;
font-family: 'Poppins', sans-serif;
margin: 0;
}
header {
padding: 1rem;
display: flex;
justify-content: flex-end;
}
.search {
background-color: transparent;
border: 2px solid;
border-radius: 50px;
font-family: inherit;
font-size: 1rem;
padding: 0.5rem 1rem;
color: #fff;
}
.search :placeholder {
color: #7378c5;
}
.search :focus {
outline: none;
}
main {
display: flex;
flex-wrap: wrap;
}
.movie {
width: 300px;
margin: 1rem;
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.2);
position: relative;
overflow: hidden;
border-radius: 3px;
}
.movie img {
width: 100%;
}
发布于 2021-08-15 10:50:12
有两种方法可以包含样式表:
方法1,使用@import
<style>
@import url("./path/to/styles.css")
</style>如果您使用的是@import,请确保它位于样式块的顶部。
方法2,使用<link />
<head>
<link href="./path/to/styles.css" rel="stylesheet"/>
</head>https://stackoverflow.com/questions/68790087
复制相似问题