链接文件扩展名修正

发布于 2024-12-23 11:58:29 字数 234 浏览 2 评论 0原文

我只是在我的 Mac 上的本地服务器上为网页制作一些 html。我添加了指向存储在本地服务器上的样式表的链接,但忘记在 href 属性中添加“.css”文件扩展名。直到我将文件上传到外部托管服务器时,我才意识到自己的错误 - 因为不知何故,可以在本地服务器上找到没有扩展名的样式表,而当我尝试从外部服务器加载页面时,扩展名却没有假设我的样式没有加载。

哪个实体发现了我的错误并在本地纠正了它,为什么当页面托管在外部时我的错误没有得到纠正?

I was just crafting some html for a webpage on a local server on my mac. I added a link to a stylesheet stored on my local server, but forgot to add the ".css" file extension in the href attribute. I didn't realize my mistake until I uploaded my files to an externally hosted server--because somehow the stylesheet could be found without the extension on my local server, whereas when I tried to load the page from the external server the extension was not assumed and my styles didn't load.

What entity figured out my error and corrected it locally, and why wasn't my error corrected when the page was hosted externally?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁吢 2024-12-30 11:58:29

可能是您的本地 Web 服务器将文件作为文本/CSS 提供,而外部服务器则不然。如果您在 CSS 文件的 LINK 标记内使用 TYPE="text/css" 会发生什么?这应该会强制它将链接文件解释为文本/css。

It could be that your local web server is serving the file up as text/css and the external one is not. What happens if you use TYPE="text/css" inside your LINK tag to the CSS file? That should force it to interpret the linked file as text/css.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文