Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you define attribute selectors in SASS?

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?

like image 501
Craig Walker Avatar asked Jan 25 '11 01:01

Craig Walker


People also ask

How do I use attribute selectors?

CSS [attribute^="value"] Selector The [attribute^="value"] selector is used to select elements with the specified attribute, whose value starts with the specified value. The following example selects all elements with a class attribute value that starts with "top": Note: The value does not have to be a whole word!

What is a selector in Sass?

The selector functions are used to check and manipulate selectors.

What selector nesting in Sass is used for?

Contents. The parent selector, & , is a special selector invented by Sass that's used in nested selectors to refer to the outer selector. It makes it possible to re-use the outer selector in more complex ways, like adding a pseudo-class or adding a selector before the parent.

How do I style a data attribute in CSS?

To use this selector, add a pipe character (|) before the equals sign. For example, li[data-years|="1900"] will select list items with a data-years value of “1900-2000”, but not the list item with a data-years value of “1800-1900”. Value ends with: attribute value ends with the selected term.


2 Answers

You can also nest it like this

input   &[type="submit"]     ....    &[type="search"]     ....  
like image 192
Rajeesh Avatar answered Sep 17 '22 11:09

Rajeesh


This converter website says:

input[type=submit]   // properties 
like image 40
Craig Walker Avatar answered Sep 18 '22 11:09

Craig Walker