gpt4 book ai didi

html - 链接 css 文件会删除背景

转载 作者:太空宇宙 更新时间:2023-11-04 15:02:13 25 4
gpt4 key购买 nike

此问题已得到解答:好的,我找到了解决方案。问题是 css 文档仍然包含 html 标签。感谢所有提供帮助的人。

我一直在使用 css 设计网站。当 css 直接在 HTML 代码中时,该站点可以完美运行。但是,如果我将 css 保存在与 html 文件位于同一目录的外部文件中,并使用标签将其包含在内,它会保留布局但背景会消失。背景设置为图像。下面是我的 CSS 代码。

<style type="text/css">
body {
background-image: url('http://www.thepeepinghole.tk/pics/stone.jpg');
color: white;
}
#menubar {
position: relative;
width: 75%;
height: 60px;
}
#menubar svg {
margin: 0px;
width:100%;
}
#menubar h3 {
position: absolute;
top: 0px;
left: 10px;
}
#top {
height: 150px;
width: 75%;
background-color: rgba(0,0,0,0.6);
}
#top img {
position: absolute;
left: 11%;
top: -2%;
width: 266px;
height: 200px;
width: auto;
z-index: 2;
}
#top img.mirror {
position: absolute;
left: 69%;
top: -2%;
width: 266px;
height: 200px;
width: auto;
z-index: 2;
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
filter: FlipH;
-ms-filter: "FlipH";
}
#top h2 {
position: relative;
top: 30%;
}
#top h1 {
position: relative;
top: 30%;
}
#menubar a {
color: white;
}
#menubar img {
position: absolute;
top: 0px;
left: 85%;
float: right;
}
#content {
width: 75%;
background: rgba(0,0,0,0.6);
}
</style>

我用这段代码将它包含在我的 html 的头部:

<rel link="StyleSheet" href="http://thepeepinghole.tk/mainpage.css" type="text/css" />

最佳答案

看起来你的语法有问题:应该是:

<link rel="stylesheet" href="http://thepeepinghole.tk/mainpage.css" type="text/css">

不是

<rel link="stylesheet"...>

关于html - 链接 css 文件会删除背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16306667/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com