背景图像上传到服务器时不显示 [英] background-image not showing when uploaded to server

查看:183
本文介绍了背景图像上传到服务器时不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我上传到我正在使用的服务器后,svg文件在我的后台没有显示出现问题。确保文件权限允许它在服务器上可读,当我打开我的html文件在我的电脑上,你可以看到它,但如果你去的网址,它不显示。只有我们使用的浏览器是chrome。有任何想法吗?似乎很奇怪,因为我没有改变任何东西,我上传它之前。这是我的CSS:

Having a problem with an svg file not showing up in my background after its been uploaded to a server I'm using. Made sure the file permissions allow it to be readable on the server and when I open my html file on my computer you can see it, but if you go to the url it doesn't show. Only browser we're working with is chrome. Any ideas? Seems strange since I didn't change anything before I uploaded it. Here's my CSS:

.paradox{
    background-image:url('paradox.svg');
    background-repeat:no-repeat;
    background-size: cover;
    }

和我使用CSS的HTML:

and my html using the CSS:

<html>
<head>
    <title>Homework 5</title>
    <link rel="stylesheet" type="text/css" href="style.css">
</head>

<body class="paradox">
<p class="spacing">
<iframe class="resize" src="form.html" frameborder="0" >
</p>
</body>
</html>


推荐答案

确保SVG文件提供了正确的MIME类型。打开开发人员工具,转到网络标签并加载您的网页。打开您的SVG文件的URL,并确保类型列中显示 image / svg + xml

Make sure the SVG file is delivered with the correct MIME type. Open the developer tools, go to the Network tab and load your page. Open the URL of your SVG file and make sure the Type column says image/svg+xml.

MIME类型不正确,然后将以下行添加到您的SVG文件的祖先目录中的 .htaccess 文件:

If the MIME type is not correct, then add the following line to an .htaccess file in an ancestor directory of your SVG file:

AddType image/svg+xml svg

服务器支持 .htaccess 文件)。

这篇关于背景图像上传到服务器时不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆