So, I was interested in the following: I have a main div div and a div in the sidebar, and the CSS looks like this:
.main{ width: 400px; height: 300px } .sidebar{ width: 100px; height: 300px; }
Now I will not include all floating properties, since I am only interested in the following: If I have an p element in both of them and I want them to have different styles, I have to give paragraphs of different classes or I have to define their style in the following way:
.main p{ color: blue; text-align: right; font-family: ... }
And then for .barbar p I would define something else ... An alternative would be to define the class p.myclass and define the style there. I'm trying to figure out which is better. Obviously, I need less markup if I have 30 p elements in one of the elements with the first method, since I would have to give them the whole class. On the other hand, I am creating CSS that I can only use for this parent element, instead of having a common definition that I can apply elsewhere on the site ... I noticed that in many "big" websites almost every html element has its own class ... Any ideas?
source share