pstein Posted August 22 Share Posted August 22 Assume the following code: <div class="foobar" ....> // target <div class="foobar" ...>....</div> </div> <div class="foobar" .... >....</div> Now I want to assign a new CSS rule to only the first element which has the class “foobar”. In the sample above the with “target” as comment. How can I address this? [foobar]:first { color: red } or .foobar:first { color: red } do not work Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now