gpt4 book ai didi

html - 放在远程服务器上时 CSS 文件不起作用

转载 作者:太空宇宙 更新时间:2023-11-04 01:37:27 26 4
gpt4 key购买 nike

一旦我将 HTML 代码通过 FTP 传输到服务器上,我就无法将它链接到我的 CSS 代码。 CSS 文件和 HTML 文件都在服务器上的同一目录中。我想指出,我已尝试清除浏览器缓存并使用不同的浏览器,但似乎没有任何效果。

这是我的 HTML 代码:

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<base href="http://people.rit.edu/~username/rop/" target="_blank">
<title> My ROP Home Page </title>
<link href= "style.css" type="text/css" rel="stylesheet">
</head>
<body>
<div class = "things">
<h1> All About Me </h2>
<div id = "activities">
<h2> I'm a fan of video games </h2>
<p> As the title suggests, I love to play video games. I have been playing video games since I was 8 years old. I started with a Nintendo 64 and have since then begged my parents for every new system to date (obviously that wont work anymore).
This hobby is part of the reason I wish to become a web developer. When I was young, I spent time browising websites like IGN, and thought that one day I could make something like that. Now I set my sights a little higher, seeing as I want to be able to develope professional websites.
</p>
<h2> My Favorite Food is Pizza ( I Can't get enough!) </h2>
<p> Seriously, I could have Pizza everyday of the week and not get sick of it. I like all kinds of toppings except pineapple. I must have pizza at least once a week no matter how unhealthy that may be. Of course, local buisnesses make better pizza then large chains.
</p>
<h2> I am a SOIS student focusing on Web Development and other IT centered courses</h2>
<p> SOIS is the School of Individualized Study. Basically I create a major that is more in line with what I want to get out of R.I.T. Students of SOIS must pick two specializations in order to create a degree. Other than that, it is just like other degrees at R.I.T with many of the same requirments.
For example, I specialize in Web Development (front-end) and some networking.
</p>
<h2> I'm a Big Fan of cheesey monster movies </h2>
<p> For reasons unknown, I have been drawn to old Godzilla movies that clearly have not aged well. I think it's neat to see how they made those films without cgi or technology. Seeing the behind the scenes of the mini cities is always a neat experience for film fans.
</p>
</div>
</div>
<div id = "brian">
<img src ="brian.jpg" alt="brian" style="width:304px;height:228px;">
</div>
</body>

</html>

CSS 代码

h1, h2, p{
background-color: #100733;
}
title {
font-family: Helvetica, Arial, sans-serif;
text-align: center;
text-transform: uppercase;
}

.things {
color: white;
font-size: 18px;
}
#brian {
float: right;
}
#activities {
font-size: 18px;
text-align: left;
}

p {
background-color: #100733;
color: white;
}

如有任何帮助,我们将不胜感激。

最佳答案

你是不是忘了开头<在第一行 (Doctype)?

制作<!DOCTYPE html>并确保您的 style.css文件与索引文件位于同一目录中。

编辑:

Not Found

The requested URL /~username/rop/ was not found on this server.

Apache Server at people.rit.edu Port 443

所以它因为 base 而不起作用标签。您确定提供的位置有效吗?当我打开 https://people.rit.edu/~username/rop/它给出 443。

编辑 2:

改变:

<base href="http://people.rit.edu/~bxa9985/rop/" target="_blank">

收件人:

<base href="https://people.rit.edu/~bxa9985/rop/" target="_blank">

关于html - 放在远程服务器上时 CSS 文件不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45950154/

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