Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Understanding CSS inheritance
Message
 
 
À
23/12/2014 02:36:46
Information générale
Forum:
CSS
Catégorie:
Autre
Divers
Thread ID:
01612514
Message ID:
01612626
Vues:
30
>>>>I am sure that again I am hitting the lack of some basic understanding of CSS. So please help me understand.
>>>>
>>>>I want to include Bootstrap.css in one of the pages but BEFORE my own .CSS. So that my .CSS would take precedence.
>>>>
>>>>For example, in MY.CSS I have a class .FieldWR that set the size of the font of asp:textbox to .75em. And it works when I don't include Bootstrap.css at all. When I add the Boostrap styles in the .ASPX file, before MY.CSS the font size of the text boxes is smaller than what I want. When I look in the Chrome Developer Tools I see the following:
>>>>
>>>>
>>>>
>>>>.FieldWR { My.css: ###
>>>>   font-size: 0.75em;
>>>>   font-weight: normal:
>>>>}
>>>>
>>>>html {    bootstrap.min.css: ###
>>>>   font-size: 62.5%
>>>>   -webkit-tap-hightlight-color: rgba(0,0,0,0);
>>>>}
>>>>
>>>>
>>>>
>>>>So it looks from the above the bootstrap HTML overrides my class. Why?
>>>
>>>Where are you seeing this in DT ? IAC, the order in which the styles are loaded is only really important if the selector is the same - in that case the last loaded will take precedence.
>>>
>>>In your case, based on specificity, the .FieldWR class selector should override the html element selector so something else must be going on. If you select the element that is using the .FieldWR class in DT Elements then the styles tab should tell you exactly how the final appearance has been determined.
>>>
>>>Useful toy that will calculate specificity for you : http://specificity.keegan.st/
>>
>>I will read again about specificity (I know I read this stuff before but forgot). What Rick suggested makes sense that I should specify the font size. I will have to read as to what is the good practice for specifying the font size in exact terms.
>>Thank you.
>
>I should have looked more closely at your code. I just made the assumption that font-size in .FieldWR *was* been overridden as you thought - after Rick's post I realized that you were probably getting exactly what you asked for :-}

I feel like a victim of my own ignorance :)
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform