首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >样式文件更改不生效

样式文件更改不生效
EN

Stack Overflow用户
提问于 2021-08-15 08:56:41
回答 1查看 41关注 0票数 0

我正在使用api构建一个电影网站。

当我链接css样式时,似乎什么都不起作用。甚至连背景色都没有。此外,我还试图添加flex,其中一个是不起作用的。链接中有什么问题吗?

这是我在这个网站上的第一个问题,我还在学习html和css。

代码语言:javascript
复制
@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%;
}

EN

回答 1

Stack Overflow用户

发布于 2021-08-15 10:50:12

有两种方法可以包含样式表:

方法1,使用@import

代码语言:javascript
复制
<style>
    @import url("./path/to/styles.css")
</style>

如果您使用的是@import,请确保它位于样式块的顶部。

方法2,使用<link />

代码语言:javascript
复制
<head>
    <link href="./path/to/styles.css" rel="stylesheet"/>
</head>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68790087

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档