本地磁盘删除了css文件,创建了新的css文件,但无法将其链接到HTML文档
当html文档和css是否在同一文件夹中时,您必须给出路径。我认为它可以在css文件中正常工作。检查css是否有错误,也可以尝试禁用浏览器缓存,如果您使用Chrome浏览器,请按F12,转到“网络”选项卡,选中“禁用缓存”并重新加载页面 编辑:我没有足够的声誉来写这篇评论:看看你的CSS文件会很有用本地磁盘删除了css文件,创建了新的css文件,但无法将其链接到HTML文档,html,css,Html,Css,当html文档和css是否在同一文件夹中时,您必须给出路径。我认为它可以在css文件中正常工作。检查css是否有错误,也可以尝试禁用浏览器缓存,如果您使用Chrome浏览器,请按F12,转到“网络”选项卡,选中“禁用缓存”并重新加载页面 编辑:我没有足够的声誉来写这篇评论:看看你的CSS文件会很有用 编辑2:尝试暂时将CSS复制到另一个文件中,并在链接的文件中应用基本样式,例如body{background:red},以检查文件是否正确链接。如果是,可能是CSS中有错误。浏览器控制台是否有输出?
编辑2:尝试暂时将CSS复制到另一个文件中,并在链接的文件中应用基本样式,例如
body{background:red}
,以检查文件是否正确链接。如果是,可能是CSS中有错误。浏览器控制台是否有输出?您正在使用哪个浏览器?这里没有任何人可以使用的帮助。您希望我们做什么?css文件是否与索引文件位于同一目录中?请尝试/theme.css
。而且还要确保HTML文档和CSS文件在同一个文件夹中。这两个文件都在同一个文件夹home/desktop/test(test=folder)我完全被我的索引文件无法链接到CSS的方式搞糊涂了。我只是将它用作“theme.CSS”和./theme.CSS和../theme.CSS,但它仍然不起作用,而且两个文件都在同一个文件夹中,它位于我的桌面Ctrl+F5
上,用于硬刷新。清除浏览器缓存:)我以为清除缓存时ctrl+shift+r会刷新,所以我创建了一个新文件夹,复制了HTML文档,并在新文件夹中创建了一个新文件夹。链接到具有粉红色背景的新样式表的HTML文件。当我从“有300行代码”的旧样式表中获取样式时,它不起作用。我只是浏览了一下我的CSS,没有发现任何问题。我可以把代码贴在上面。但它会很长。看起来你的大多数风格都被覆盖了,检查员是否会说覆盖你风格的规则来自哪个文件?尝试将
标记放在标题末尾,其他
标记之后。
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Traditionals Barbershop</title>
<link rel="stylesheet" href="theme.css">
<link href="https://fonts.googleapis.com/css?
family=Roboto+Slab"rel="stylesheet ">
</head>
html,
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
background: #fff;
}
h1 {
color: white;
margin: 0;
}
h3 {
margin: 0;
padding: 0;
}
.window-wrapper {
position: relative;
}
.main-nav {
background: rgba(0, 0, 0);
border-bottom: 3px solid #fdca64;
width: 100%;
display: flex;
justify-content: space-between;
}
.header-logo {
padding-top: 10px;
}
.main-ul {
box-sizing: border-box;
display: flex;
justify-content: space-around;
margin: 0;
padding: 1rem;
text-transform: uppercase;
font-weight: bold;
list-style: none;
}
.logo {
position: absolute;
max-height: 40px;
padding-left: 10px;
}
.main-li {
margin: 0 1em;
}
a.nav-links {
color: #fdca64;
display: inline-block;
text-decoration: none;
text-shadow: 1px 1px #525050cc;
transition: border 0.5s ease-in 0.5s;
}
/* activates hover transition */
.nav-links:hover {
color: rgb(255, 255, 255);
}
.nav-links:after {
content: "";
display: block;
border-bottom: solid 3px #fdca64;
box-shadow: 3px 2px 9px 1px #211f1f;
transform: scaleX(0);
transition: transform 250ms ease-in-out;
}
.nav-links:hover:after {
transform: scaleX(1);
transform-origin: 0% 50%;
}
/******* End of Navigation *******/
.greeting-text {
display: flex;
justify-content: center;
position: relative;
height: 8em;
background-color: rgb(0, 0, 0);
}
.header-h1 {
color: rgba(255, 255, 255);
font-family: "Roboto Slab", serif;
font-size: 4em;
letter-spacing: 2px;
position: absolute;
text-transform: uppercase;
text-shadow: 3px 2px #9c9797;
word-spacing: 5px;
z-index: 1;
}
.slogan {
position: absolute;
z-index: 1;
color: rgb(255, 255, 255);
top: 80%;
font-size: 1.5rem;
text-transform: uppercase;
transform: translateY(-80%);
text-shadow: 2px 1px #9c9797;
font-weight: bold;
line-height: 25px;
margin: 0;
}
.showcase-wrapper {
position: relative;
display: flex;
flex-wrap: wrap;
justify-content: center;
background-color: #000;
}
.header-image {
display: flex;
justify-content: center;
position: relative;
margin: 0.5rem;
width: 45%;
}
.main-imgs {
max-height: 500px;
width: 100%;
box-shadow: 0px 0px 5px 1px;
border: 3px solid #fdca64;
}
/**** End Of Showcase ****/
.information-wrapper {
display: flex;
flex-wrap: wrap;
flex-direction: row;
position: relative;
}
.section-2,
.section-3 {
border: solid black;
margin: 10px;
position: relative;
}
.slideshow-container {
box-sizing: border-box;
position: relative;
margin: auto;
width: 100%;
}
.rotated-image {
width: 100%;
border: green 5px solid;
}
.slides {
display: none;
}
.prev,
.next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
margin-top: -22px;
padding: 16px;
color: white;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
}
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
.prev:hover,
.next:hover {
background-color: rgba(0, 0, 0, 0.8);
}
.dot {
cursor: pointer;
height: 15px;
width: 15px;
margin: 0 2px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
transition: background-color 0.6s ease;
}
.active,
.dov:hover {
background-color: #717171;
}
.fade {
animation-name: fade;
animation-duration: 1.5s;
}
@-webkit-keyframes fade {
from {
opacity: 0.4;
}
to {
opacity: 1;
}
}
@keyframes fade {
from {
opacity: 0.4;
}
to {
opacity: 1;
}
}
.section-2 {
width: 40%;
max-height: 300px;
}
.section-2 h3 {
font: italic bold 20px/30px Georgia, serif;
position: absolute;
text-align: center;
letter-spacing: 1px;
}
@media only screen and (max-width: 768px) {
.header-image {
justify-content: center;
position: relative;
margin: 0.5rem;
width: 41%;
display: flex;
}
}
@media only screen and (max-width: 425px) {
.header-image {
min-width: 300px;
left: 2%;
}
.main-imgs {
max-width: 300px;
max-height: 200px;
}
.header-h1 {
font-size: 17px;
width: 100%;
}
.showcase-wrapper {
width: 95%;
}
}