www.webdeveloper.com
Results 1 to 2 of 2

Thread: CSS is not taking effect

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    51

    CSS is not taking effect

    Sorry, another Noob question here:

    I have a Java Web App with the following dir structure:

    appRoot
    appRoot/CSS/myStyle.css
    appRoot/WEB-INF/JSP/HomePage.jsp

    HomePage.jsp has this:
    Code:
    <link rel="stylesheet" type="text/css" href="../../CSS/myStyle.css" />
    But for some reason, when this JSP gets served, the stylesheet is not taking effect, and I can't figure out why.

    I have a feeling it's something stupid and small that I missed.

  2. #2
    Join Date
    Sep 2009
    Posts
    51

    Resolved

    The issue was that I was assuming the path to the CSS resource is relative to the JSP location. Instead, it should be relative to the app context root location.

    Code:
    href="CSS/myStyle.css"
    Instead of:

    Code:
    href="../../CSS/myStyle.css"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles