Can I have an onclick effect in CSS?

后端 未结 12 1763
悲&欢浪女
悲&欢浪女 2020-11-21 06:42

I have an image element that I want to change on click.


This works:

#btnLeft:hover {
    width:7         


        
12条回答
  •  被撕碎了的回忆
    2020-11-21 07:29

    you can use :target

    or to filter by class name, use .classname:target

    or filter by id name using #idname:target

    #id01:target {      
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .msg {
        display:none;
    }
    
    .close {        
        color:white;        
        width: 2rem;
        height: 2rem;
        background-color: black;
        text-align:center;
        margin:20px;
    }
      
    Open
    
    
    ×

    Some text. Some text. Some text.

    Some text. Some text. Some text.

提交回复
热议问题