Can I use DIV class and ID together in CSS?

后端 未结 9 1482
名媛妹妹
名媛妹妹 2020-12-25 10:21

Can I use DIV Class and ID together in CSS? For example:

--
9条回答
  •  既然无缘
    2020-12-25 10:48

    Yes you can.

    You just need to understand what they are for, the class is more general and can be used several times, the id (is like your id's) you can use it only once.

    This excellent tutorial helped me with that:

    The Difference Between ID and Class

    Though it's not an exact answer to your question I'm sure it will help you a lot!

    Good luck!

    EDIT: Reading your question, I just want to clarify that:

    --

    And that if you want to "use them" in CSS for styling purposes you should do as David Says: #x.y { }

提交回复
热议问题