Omnimaga
General Discussion => Technology and Development => Web Programming and Design => Topic started by: flyingfisch on June 13, 2012, 06:07:44 pm
-
Dumb question I know, but anyway. How do I change the properties for a tag inside a class?
example:
<tag class="class">
<atag></atag>
<tag>
To edit stuff for atag, is it
.class atag {
stuff
}
Or is it
atag .class {
stuff
}
Thanks
-
atag.class{
/* stuff */
}
or.class{
/* stuff */
}
Although this will affect anything with this class. You can also useatag{
/* stuff */
}
For all references of atag
-
atag.class{
/* stuff */
}
Eeems, he wants to know how to target atag as a descendant of .class, not the element itself.
What you're looking for is.class atag
{
/* stuff */
}
(your first guess, flyingfisch).
-
Oh right lol, I just skimmed the question.
Another more specific way to do this would betag.class atag{
/* stuff */
}
-
Thanks for the replies guys :)
-
To prevent any confusion, could you explain what is <atag> though? Can one just use any nonexistent tag in his HTML code to assign CSS properties to it?
-
Well, you can actually use nonexistant tags and your browser won't even complain. It won't pass the W3C Validator though. And I never tried it, but I think the CSS parser won't even care if your tag exists or not.
-
Some might throw warnings. I know I've used non-existent tags before. Not a good idea to do though.
-
To prevent any confusion, could you explain what is <atag> though? Can one just use any nonexistent tag in his HTML code to assign CSS properties to it?
The reason I used <atag> was just to create some arbitrary code.
It could be any tag like <span>, <div>, etc. ;)