728x90
1. index.blade.php에서 img src로 불러오는건 public이든 resources든 상관이 없다
<!DOCTYPE html>
<html lang="kr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
@vite(['resources/css/index.css','resources/js/script.js'])
</head>
<body>
<h1>Hello world</h1>
</body>
</html>
2. 하지만 css에서 images를 불러오려면 public이아닌 resources에서 가능하며 경로는 절대경로가 아닌 상대 경로로 지정해주어야 css가 나온다.
index.css
body{
margin:0; /* 원래 기본 background는 margin이 8이다. */
background-image: url("../images/background.jpg");
background-repeat: no-repeat; /* 공간채우기위해 여러개 들어가는 것을 금지, 한개만 */
background-size: cover; /* cover는 검색해보기 */
/* background-color: red; */
}
728x90