简体   繁体   English

覆盖引导样式表失败

[英]Failed override bootstrap stylesheet

I am using bootstrap webjars (maven dependencies) with my jsp pages, and I tried to override bootstrap stylesheet by creating new stylesheet. 我在我的jsp页面上使用了bootstrap webjars(maven依赖项),并且我试图通过创建新的样式表来覆盖bootstrap样式表。 But, I can't see any changes, even though I respect the order of stylesheet in jsp pages and I added the new stylesheet to servlet-context. 但是,即使我尊重jsp页面中样式表的顺序,并且将新样式表添加到servlet上下文中,我也看不到任何更改。 Any idea how to fix this ? 任何想法如何解决这个问题?

This is the servlet-context : 这是servlet上下文:

<resources mapping="/resources/**" location="/resources/" />
<resources mapping="/webjars/**" location="/webjars/"/>
<resources mapping="/bootstrap/css/**" location="/bootstrap/" />

and this the declaration of stylesheets in jsp page : 这是jsp页面中样式表的声明:

<title>Home</title>
<link href="webjars/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="/bootstrap/css/stylesheet.css" type="text/css" rel="stylesheet">
</head>
<body>

and this is stylesheet I created, it's not complet 这是我创建的样式表,不是完整的

body {
background-color:lightblue !important;
}

h1{

color:navy  !important ;
margin-left: 20px !important;
}

A then you can apply the same code of css that wrote by you with "!important" of the same page where you want to apply the css ... 然后,您可以将您编写的css的代码与要应用css的同一页面的“!important”一起使用...

<html>
   <body>
     <head>
       <style>
          ## YOUR CODE##
       </style>
     </head>
   </body>
</html>
""

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

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