how to add and remove css class

后端 未结 5 1708
清歌不尽
清歌不尽 2021-01-21 06:18

how to remove CSS default class

This is my div

This is my css class

#messageContai         


        
5条回答
  •  既然无缘
    2021-01-21 06:47

    You are not defining a css class in your example, you are using the selector for the id.

    to use a class your code would be like:

    and in your stylesheet or between style tags you would have

    .messageContainer{  
      height:26px;  
      color:#FFFFFF;    
      BACKGROUND-COLOR: #6af; 
      VERTICAL-ALIGN: middle;
      TEXT-ALIGN: center;
      PADDING-TOP:6px;  
    }
    

    then, using jquery you could remove this class by doing

    $('#messageContainer').removeClass('messageContainer');
    

提交回复
热议问题