0

I want to set an attribute to two links with different IDs. Links are contained in a div with ID UserDiv. Something like this:

div#UserDiv (a#login_link, a#register_link){
    float:right;
}

But this obviously doesn't work. Is it even possible?

1 Answer 1

4

That syntax is not legal, but you can do it. In general, you need to repeat the div#UserDiv part:

div#UserDiv a#login_link, div#UserDiv a#register_link
{
    float:right;
}

In this specific case you might be able to just remove the div selector entirely since the ids of the anchors are enough to uniquely identify them. Of course this depends on you not using these same ids in a different part of the DOM under different circumstances, which is IMHO a good idea to do.

Sign up to request clarification or add additional context in comments.

1 Comment

Ok, this will do too ;) Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.