我有一个 View 有一个 <body></body>
那应该显示背景图像。我以前做过,但现在不起作用。背景图片下载到我的电脑上,它位于我的 Laravel 实例中元素的公共(public)文件夹中。
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<script src="{{ asset('js/app.js') }}" defer></script>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<title>ACAVUCAB</title>
<style>
body {
padding-top: 56px;
background-image: url(fondo_cerveza1.jpg);
background-size: cover;
}
.dropnegro {
color: #141519;
text-align: center;
}
nav.navbar {
background: #141519;
background: linear-gradient(to right, #424448, #B7BCCD);
}
.tamano {
font-size: 16px;
}
.tope {
margin-top: 10px;
}
.centro {
text-align: center;
}
</style>
</head>
<body>
<div class="app">
@yield('content')
</div>
</body>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="js/bootstrap.min.js"></script>
</html>
最佳答案
这是相对路径的问题。我必须做 url("/fondo_cerveza1.jpg");
关于html - 在 Laravel 6.0 之前工作的背景图片不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59314352/