简体   繁体   English

Twitter Bootstrap + JSP (Spring MVC) - 样式不适用

[英]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.不过,我对整个样式设计非常陌生,我决定尝试使用 Twitter Bootstrap 来让我的 UI 在原型设计阶段看起来不那么糟糕。 Seems to me, I did everything I had to make it right, however, the page keeps displaying as plain html.在我看来,我做了所有我必须做的事情,但是,页面一直显示为纯 html。 I'd be really appreciate any help provided.我会非常感谢提供的任何帮助。 Here's the page I'm talking about: http://pastebin.com/DbiJHLyc .这是我正在谈论的页面: http : //pastebin.com/DbiJHLyc The bootstrap folder is located at /project_name/src/main/webapp/. bootstrap 文件夹位于 /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.您必须了解 JSP 的位置和源文件夹中 CSS 文件的位置并不重要。 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.重要的是用于在浏览器中加载 HTML 页面的 URL,以及可以使用浏览器访问 CSS 文件的 URL。

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如果页面的 URL 是http://localhost/myApp/some/path.html ,并且 css 所在的 URL 是http://localhost/myApp/css/some/other/path/bootstrap.css ,那么该页面应包含

<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">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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