Here is some code of my main jsp file:
<link rel="stylesheet" type="text/css" href="<c:url value='/styles/bootstrap.min'/>,bootstrap-switch.min.css" />
<link rel="stylesheet" type="text/css" media="screen" href="<c:url value='/styles/main.css'/>"/>
The main.css
is at the line after bootstrap css
, so usually, main.css
will override the bootstrap css
. (correct me if I am wrong.)
Inside main.css
, I have create 1 class as follow:
.testjx{
background-color: yellow;
vertical-align:middle;
}
And here is my sub jsp file:
<td class="testjx">
1000000
</td>
When I view the page in browser, I found that vertical-align:middle
is override by bootstrap css
file, as follow screen shot:
I try my best to find out the root cause, but fail. Kindly advise.
You must do like this:
table tr td.testjx, table tfoot tr td.testjx, table thead tr td.testjx, table tbody tr td.testjx{
vertical-align:middle;
}
You need to inspect where the class is to short the css code...check if is on the tfoot, thead or tbody or general
I get around this by adding !important
to the relevant CSS ie font-weight:bold !important;
and this stops it being overridden regardless of which file it's in. Simples.
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.