Naj Naj - 27 days ago 10
CSS Question

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. 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. Any idea how to fix this ?

This is the servlet-context :

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

<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;
}

Answer

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

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