I know it is possible to select all instances of a element in an #id tag.
ex: #generic-id-tag h1
But I have had no luck with doing it with a class.
ex: .generic-class h1
Is there a trick I am missing or is it just not possible. I have tried searching for a solution but since I am fairly new to CSS I might not be using the right nomenclature in my search.
DogsGhost has a point - though it's officially referred to as CSS "Specificity." Being 'fairly new' to CSS I figured the initial response went far above your head - its an advanced concept. Here's a nice overview of the specificity concept (and now you'll know what to search for);
@aaronsilber That is a great article you found, and I'm all for giving as much valuable information to people as possible, but I really wouldn't call it an advanced concept. In the same class where I learned what css even was, I learned about specificity. I would consider it a fundamental.
Thanks you DogsGhost and aaronsilber. It was a hierarchy issue. I read the article, wiped what I had been working on and recoded it with a better understanding of CSS weight.
For me, it isn't whether it is an advance concepts or not, it is more that I am teaching myself CSS through building website concepts. Advanced or not, it is more when I organically run into the problem.
ex: #generic-id-tag h1
But I have had no luck with doing it with a class.
ex: .generic-class h1
Is there a trick I am missing or is it just not possible. I have tried searching for a solution but since I am fairly new to CSS I might not be using the right nomenclature in my search.
Thanks in advance for any help.
-Ash
Your issue might be with the 'weight' of the compound.
tags=1pt
classes=10pts
ids=100pts
inline stlye=1k pts.
So if you have :
<div id="id" class="class">
<h1></h1>
</div>
Your css for #id h1 { } (weight 101) will always override .class h1 { } (weight 11).
http://www.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/
That is a great article you found, and I'm all for giving as much valuable information to people as possible, but I really wouldn't call it an advanced concept. In the same class where I learned what css even was, I learned about specificity. I would consider it a fundamental.
For me, it isn't whether it is an advance concepts or not, it is more that I am teaching myself CSS through building website concepts. Advanced or not, it is more when I organically run into the problem.