how to make div click-able?

前端 未结 9 1116
春和景丽
春和景丽 2020-12-08 07:15
shanghaimale

For div like above,when mouse on,it should become cursor:poin

9条回答
  •  再見小時候
    2020-12-08 07:39

    add the onclick attribute

    shanghaimale

    To get the cursor to change use css's cursor rule.

    div[onclick] {
      cursor: pointer;
    }
    

    The selector uses an attribute selector which does not work in some versions of IE. If you want to support those versions, add a class to your div.

提交回复
热议问题