html - Some Css classes working, others are not -


i have asp.net page developing. using bootstrap , working fine. have custom stylesheet use fine tune , feel. of point in last 2 days, new classes create in custom stylesheet , try apply element on page fails make change. example, have div on page, basic div created troubleshoot issue, though applies element on page, trying change background color for. created 1 css class ".background-pink" couple days ago , if set div use class, div turns pink supposed to. however, have class right below class in stylesheet called .background-blue same thing,it sets background same color(it blue during testing changed same color background-pink class narrow down issues) , if change div class reference .background-blue class, pink background disappears , style not applied. can set class pink 1 , changes pink fine. replicated across newly created classes in stylesheet.

i have tried clearing browser caches , tried incognito modes, different browsers same results. have checked syntax errors in css found none. intelliprompt in visual studio can find class names fine, leading me believe have linked in head correctly. have renamed stylesheet no change. have cleaned , rebuilt application multiple times no results. if put styles in div using inline css works fine.

this makes no sense me, suggestions appreciated. thanks!

.background-pink {    background-color: #e33491;  }    .background-blue {    background-color: blue;  }    .font-white {    color: white;  }
<div class="background-blue">test</div>  <div class="background-pink">test</div>  <div style="background-color:blue">test</div>

below entire stylesheet

.negativetopmargin { margin-top:-5px;  }  .background-pink { background-color:#e33491; }  .background-blue { background-color:#e33491; }  .font-white { color:white; }  .center-div { position:relative; margin-left:auto; margin-right:auto; }  body { font-family: 'palanquin', sans-serif; background-color:red; }   .padding-4 { padding:4px; } 

note body method, font throughout page set correctly, background color put test method made no change either.

try adding following rule .background-blue class, !important

.background-blue {   background-color: blue !important;  } 

it sounds somewhere in custom stylesheet overriding .background-blue class class.

im assuming problem limited .background-blue class , not found among other classes. !important rule puts priority on class render background blue.

p.s. take note of this article when deciding on appropriate place use !important rule. dont want using often.


further example

.background-pink {    background-color: #e33491;  }    .background-blue {    background-color: blue !important;  }
<div class="background-blue ">test</div>  <div class="background-pink">test</div>  <div style="background-color:blue">test</div>    <!-- below div uses both background-blue , background-pink classes,   background-blue uses !important rule   overrides last class applied background-pink !-->  <div class="background-blue background-pink">test</div>


as mentioned in comments possible server aware of updated stylesheet sending headers browser instruct render webpage older cached version. can check opening developer tools f12 , studying headers come through on page load.

a hard refresh ctrl + f5 solves problem in extreme cases need manually adjust headers. see this answer further information.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -