• 로그인
  • 장바구니에 상품이 없습니다.

home2 게시판 HTML/CSS 게시판 외부 css 불러오기 문제입니다.

외부 css 불러오기 문제입니다.

2 글 보임 - 1 에서 2 까지 (총 2 중에서)
  • 글쓴이
  • #117382

    오경식
    참가자
    스프링하다 생긴 문제인데 스프링 게시판이 안보여서 여기다 작성합니다.!!
    스프링 강의에서 detail.html을 아래와 같이 만들었습니다.
    nav.html을 불러왔고 list.html처럼 nav에 css를 입혀주기 위해
    <link href="main.css" rel="stylesheet">
    코드를 사용해봤지만 아래와 같은 오류 메세지가 나면서 detail.html에는 css가 입혀지지 않았습니다.
    Resolved [org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: 
    Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long'; For input string: "main.css"]
    제가 아직 지식이 없어 여기저기 검색하고 지피티한테도 마땅한 답변을 얻지 못해 결국 외부 css를 사용하는 것이 아닌 내부 스타일 시트로 해결했는데. 
    어떻게 해야지 외부 시트를 사용할 수 있을까요? href로 불러오면서 main.css가 컨트롤러의 @Pathvariable 로 같이 넘어가서 생기는 오류일까요?
    너무 답답합니다 ㅜㅜ
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport"
              content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>상세페이지</title>
        <style>
            .nav {
                display: flex;
                padding: 10px;
                align-items: center;
                font-family : 'Montserrat';
            }
            .nav a {
                margin-right: 10px;
                text-decoration : none;
                font-weight : 400;
                letter-spacing : -0.5px;
            }
            .nav .logo {
                font-weight : 800;
            }
        </style>
        <style>
            .edit-btn {
                background-color: red;
                color: white;
                padding: 10px 20px;
                border: none;
                border-radius: 5px;
                cursor: pointer;
                text-decoration: none;
            }
        </style>
    </head>
    <body>
    <div th:replace="~{ nav.html::navbar }"></div>
    <div class="detail">
        <h4>상세페이지</h4>
        < img src="https://placehold.co/300">
        <h4 th:text="${item.title}"></h4>
        <h4 th:text="${item.price}"></h4>
        수정
    </div>
    </body>
    </html>
    
    #117401

    codingapple
    키 마스터
    경로를 /main.css 라고 써봅시다
2 글 보임 - 1 에서 2 까지 (총 2 중에서)
  • 답변은 로그인 후 가능합니다.

About

현재 월 700명 신규수강중입니다.

  (09:00~20:00) 빠른 상담은 카톡 플러스친구 코딩애플 (링크)
  admin@codingapple.com
  이용약관
ⓒ Codingapple, 강의 예제, 영상 복제 금지
top

© Codingapple, All rights reserved. 슈퍼로켓 에듀케이션 / 서울특별시 강동구 고덕로 19길 30 / 사업자등록번호 : 212-26-14752 온라인 교육학원업 / 통신판매업신고번호 : 제 2017-서울강동-0002 호 / 개인정보관리자 : 박종흠