jquery - 为什么这不打开图像?

标签 jquery html css

我的问题是图片无法加载到页面上。它在文件夹中,它是一个 .png,看起来一切都是正确的......关于如何让它加载 img 的任何想法?

header.masthead {
    text-align: center;
    color: white;
    background-image: url(..//HGlogo.png);
    background-repeat: no-repeat;
    background-attachment: scroll;
    background-position: center center;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover; 
}

最佳答案

您必须将单个/用于创建文件位置,例如

background-image: url('../img/HGlogo.png');

假设您在同一文件夹或同一位置有图像,请不要这样使用 (../)

关于jquery - 为什么这不打开图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47919197/

相关文章:

javascript - 带过滤器的 HTML 选择字段

javascript - 如何访问文本框的值

html - 没有社交媒体元素的导航栏崩溃

jquery - HTML 样式 :font-family gets messed up while rendering

html - 在 div 内滚动不起作用

jQuery追加除最后一个元素之外的所有元素

javascript - 在foreach Jquery之外访问变量

jquery 事件命名空间初学者示例

html - 与底部对齐的中心 div 组

javascript - URL 编码异常