简体   繁体   中英

Twitter Bootstrap + JSP (Spring MVC) - Styles do not apply

I'm really new to this whole styling thing, though, decided to try Twitter Bootstrap to make my UI look less poor at the stage of prototyping. Seems to me, I did everything I had to make it right, however, the page keeps displaying as plain html. I'd be really appreciate any help provided. Here's the page I'm talking about: http://pastebin.com/DbiJHLyc . The bootstrap folder is located at /project_name/src/main/webapp/.

You have to understand that the location of the JSP and the location of the CSS file in the source folder isn't what matters. What matters is the URL used to load the HTML page in the browser, and the URL where the CSS file can be accessed using your browser.

If the URL for the page is http://localhost/myApp/some/path.html , and the URL where the css is is http://localhost/myApp/css/some/other/path/bootstrap.css , then the page should contain

<link href="../css/some/other/path/bootstrap.css" rel="stylesheet">

or, better, use an absolute path like

<link href="/myApp/css/some/other/path/bootstrap.css" rel="stylesheet">

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM