99

In CSS, you can do this:

input[type=submit] {
  // properties
}

It's a very useful for styling form buttons.

How do you do the same thing in SASS?

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
Craig Walker
  • 49,871
  • 54
  • 152
  • 212

3 Answers3

184

You can also nest it like this

input
  &[type="submit"]
    .... 
  &[type="search"]
    .... 
Peter DeWeese
  • 18,141
  • 8
  • 79
  • 101
Rajeesh
  • 4,377
  • 4
  • 26
  • 29
29

This converter website says:

input[type=submit]
  // properties
DaFois
  • 2,197
  • 8
  • 26
  • 43
Craig Walker
  • 49,871
  • 54
  • 152
  • 212
-1

I use the one below in my project.

.bg-brand-3 {
  background-color: black;
  &[type="button"]:enabled {
    &:hover {
      background-color: orange;
    }
    &:active {
      background-color: green;
    }
  }
  &[type="submit"] {
    // css
  }
}

The :enable has the same meaning as :not(:disabled)

Quang Dong
  • 467
  • 5
  • 7