我无法使用css为背景设置图像

时间:2015-10-25 20:01:06

标签: html css laravel-5 background-image

我有一个laravel 5项目,我想设置和自定义图像作为背景,但我根本不能。我可以将背景设置为一种颜色 - 工作正常,但不是在我使用图像时...

这是我的代码:

<!DOCTYPE html>
<html>
<head>
<title>title</title>

<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">

<style>
    body{
        background: url("/resources/assets/images/anders.png") no-repeat;
    }
</style>

</head>
<body>
    @yield('content')
</body>
</html>

1 个答案:

答案 0 :(得分:1)

使用网址将网址引导到网站。在资源之前。

body{
    background: url("./resources/assets/images/anders.png") no-repeat;
}