简体   繁体   中英

Apply same style to multiple CSS attribute selector

How can I apply the style below to a type="submit" at the same time? Without duplicating the entire block?

input[type="button"] {
  width: 120px;
  margin-left: 35px;
  display: block;
}

using a comma( , ) just like this:

input[type="button"], input[type="submit"] {
width: 120px;
margin-left: 35px;
display: block;
}

check more info here

Use a , :

input[type="button"], input[type="submit"] {
    width: 120px;
    margin-left: 35px;
    display: block;
}

You can apply a block of styles to multiple selectors by separating the selectors with commas, as follows:

input[type="button"], input[type="submit"] {
  width: 120px;
  margin-left: 35px; 
  display: block;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM