• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

django 웹 개발 문의

22.11.28 18:16 작성 조회수 226

0

background-image를 이용해 로고를 넣으려고 합니다. 그런데 이상한 경우가 계속 발생해서 문의드립니다. 파일 경로

test\static\base.css

test\static\image.png

test\media\header\image.png

test\templates\header.html

이런식으로 폴더가 구성 되어 있습니다.

header.html 파일에서 코드를 짜고, css 같은 경우 base.css에서 불러와서 사용을 하고 있습니다.

이때 base.css 파일에서

.header_logo{
  user-select: none;
  position: absolute;
  overflow: hidden;
  left: 0rem;
  top: 0rem;
  width: 14rem;
  height: 3.5rem;
  border-radius: 0rem;
  background-color: rgb(173, 123, 97);
  background-image: url("image.png");
  background-repeat: no-repeat;
  background-position: 50% 50%;
  cursor: default;
  direction: inherit;
  border: none;
}

이런 경로로 이미지 파일을 불러오면 정상 작동 합니다.

.header_logo{
  user-select: none;
  position: absolute;
  overflow: hidden;
  left: 0rem;
  top: 0rem;
  width: 14rem;
  height: 3.5rem;
  border-radius: 0rem;
  background-color: rgb(173, 123, 97);
  background-image: url("../media/header/image.png");
  background-repeat: no-repeat;
  background-position: 50% 50%;
  cursor: default;
  direction: inherit;
  border: none;
}

이렇게 이미치 파일을 불러오면 이미지가 나오지 않습니다.

 

어떤이유로 이런 현상이 생기는 걸까요?

static 폴더에 대한 설정은 되어있고, media 폴더에 대한 설정이 되어 있지 않아 이런 경우가 생길까요?

 

문의드립니다!

답변 0

답변을 작성해보세요.

답변을 기다리고 있는 질문이에요.
첫번째 답변을 남겨보세요!