I am coming from object-oriented Python-land and need help with a basic question as I learn SASS (+compass/susy) and CSS. Globally, I am struggling to understand how to relate classes and variables as I understand it in Python.
I have a navigation bar and want all h1
tags in the navbar to be bold, but all h1
tags in the body of the html doc to be blue. How would I structure my screen.scss file to reflect what I am trying to do?
To make it a little more complicated, let's say I have more tags, like an h2
tag that I want to do the same thing with as well (except this time I want h2
to be italic and red respectively). In this case, can I start using a class selector instead of an id? Is there a way to nest my sass file such that h1
and h2
tags are only modified if they are under class='navbar'
? In python, I would say something like:
class navbar
h1 = make it bold
h2 = make it italic
h1 = make it blue
h2 = make it red
In SASS-land, how would you structure your screen.sass file such that I can just assign each html tag (<htmltag class='navbar'>
and everything behaves appropriately? Or, if there is a better way to do this with a ton of elements, I am open to that as well.
Thank you.