3
div#id_div_allposts {   
    width: 100%;    
}

div.class_div_post {
    width: 100%;
}

div.class_div_editdelete {
    width: 100%;
}

How can i write it in one line ?

And what's the way to select a html tag with id and class ?

1
  • 1
    Please take some time to read through the CSS spec about selectors. It's not a difficult read. Commented Oct 6, 2011 at 4:44

4 Answers 4

7

All you have to do is separate them with a comma e.g

div#id_div_allposts,
div.class_div_post,
div.class_div_editdelete {
    width:100%;
}
Sign up to request clarification or add additional context in comments.

Comments

0
div#id_div_allposts, div.class_div_post, div.class_div_editdelete {
    width: 100%;
}

You can group multiple selectors in CSS via a comma.

Note: The comma starts an entirely new selector from the very start.

Comments

0

Use the comma to separate multiple declarations

div#id_div_allposts, div.class_div_post, div.class_div_editdelete {
    width: 100%;
}

Selecting an html tag with and id and class would be

div#ID.class

Comments

0

Try this:

div#id_div_allposts, div.class_div_post, div.class_div_editdelete {
    width: 100%;
}

or assuming that you want all div to have width 100% then...

div{
    width: 100%;
}

Comments

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.