adding css class to multiple elements

后端 未结 4 1965
遇见更好的自我
遇见更好的自我 2020-12-28 13:20

I have created a CSS class called \'button\' and applied it to all of my INPUT tags by simply using :

.button input
{
//css stuff here
}

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-28 14:01

    Try using:

    .button input, .button a {
        // css stuff
    }
    

    Also, read up on CSS.

    Edit: If it were me, I'd add the button class to the element, not to the parent tag. Like so:

    HTML:

    BUTTON TEXT
    
    

    CSS:

    .button {
        // css stuff
    }
    

    For specific css stuff use:

    input.button {
        // css stuff
    }
    a.button {
        // css stuff
    }
    

提交回复
热议问题