Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

internal .css code scope

 
David Mutansan
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my html file, I first import some external css file ("file1.css"). Suppose the external css has a defined section called ".div_part1, .div_part2, .div_part3 { color: black; ....}" Then in this html, I define an internal section <style> ...  </style> after the external import  and within this <style> sector I override ".div_part1, .div_part2, .div_part3 {color: red; ....}"

Based on basic css rule, on this html the "color" part for " .div_part1, .div_part2, .div_part3" will take "red" since it is overriden.  Now, the question is ---

If I have 2nd html file, it also imports the same "file1.css".  In this html, it does not define anything to override the ".div_part1, .div_part2, .div_part3" stuff.   Then can I be confident whatever defined in the <style> section in the first html is only scoped to the first html file itself, it will never to accessible from the 2nd html file ?  in other words, in the 2nd html, when it needs ".div_part1, .div_part2, .div_part3 " color, it will still be black, right ?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic