About Sass Interview Preparation
Sass (Syntactically Awesome Stylesheets) is a stylesheet language initially designed by Hampton Catlin and developed by Natalie Weizenbaum.[1][2] After its initial versions, Weizenbaum and Chris Eppstein have continued to extend Sass with SassScript, a simple scripting language used in Sass files. Sass is a scripting language that is interpreted into Cascading Style Sheets (CSS). SassScript is the scripting language itself. Sass consists of two syntaxes. The original syntax, called \"the inde
For better preparation, read each question carefully, understand the concept, prepare one real example,
and connect your answer with your project or work experience.
Sass Questions List
Quick list of important Sass interview questions. Detailed answer previews are available below.
- What is SASS
- How to define variable in SASS
- How to do Nesting in SASS
- What the use of Mixins in SASS
- Is Mixins Support arguments ?
- How to use Selector inheritance and multiple inheritance?
- What is the difference between inline, embedded and external style sheets?
- What is the purpose of z-index and how is it used?
- What is a constraint? and its various types.
Question 1: What is SASS
Answer: SASS means Syntactically Awesome Stylesheets as a CSS pre-processor is a stylesheet language initially designed by Hampton Catlin and developed by Natalie Weizenbaum.After its initial versions, Weizenbaum and Chris Eppstein have continued to extend Sass with SassScript, a simple scripting language used in Sass files. Sass is a scripting language that is interpreted into Cascading Style Sheets (CSS). SassScript is the scripting language itself. Sass consists of two syntaxes. The original syntax, called the indented syntax, uses a syntax similar to Haml. It uses indentation to separate code blocks and newline characters to sep...
View detailed answer →
Question 2: How to define variable in SASS
Answer: Sass allows variables to be defined. Variables begin with a Dollar sign ($). Variable assiment is done with a colon(:) SassScript supports four data types: Numbers(including units) Strings (with quotes or without) Colors (name, or names) Boolens Variables can be arguments to or results from one of several available function During translation, the values of the variables are inserted into the output CSS document. In SCSS style $blue: #3bbfce; $margin: 16px; .content-navigation { border-color: $blue; color: darken($blue, 20%); } .border { padding: $margin / 2; margin: $margin / 2; border-color: $blue; } Or SASS style $blue:...
View detailed answer →
Question 3: How to do Nesting in SASS
Answer: SASS allows the nested code to be inserted within each other. where as CSS does support logical nesting, but the code blocks themselves are not nested. table.hl { margin: 2em 0; td.ln { text-align: right; } } li { font: { family: serif; weight: bold; size: 1.3em; } } Would compile to: table.hl { margin: 2em 0; } table.hl td.ln { text-align: right; } li { font-family: serif; font-weight: bold; font-size: 1.3em; } More complicated types of nesting including Namespace nesting and parent references are discussed in the Sass documentation
View detailed answer →
Question 4: What the use of Mixins in SASS
Answer: CSS does not support mixins Any repeated code must be repeated in each location. A mixin is a section of code that contains any valid Sass code. Whenever a mixin is called, the result of translating the mixin is inserted at the calling location. Mixins allow for efficient and clean code repetitions, as well as easy alteration of code. @mixin table-base { th { text-align: center; font-weight: bold; } td, th {padding: 2px} } #data { @include table-base; } Would compile to: #data th { text-align: center; font-weight: bold; } #data td, #data th { padding: 2px; }
View detailed answer →
Question 5: Is Mixins Support arguments ?
Answer: Yes Mixins also support arguments @mixin left($dist) { float: left; margin-left: $dist; } #data { @include left(10px); } Would compile to: #data { float: left; margin-left: 10px; }
View detailed answer →
Question 6: How to use Selector inheritance and multiple inheritance?
Answer: While CSS3 supports the Document Object Model hierarchy, it does not allow selector inheritance. Inheritance is done by inserting a line inside of a code block that uses the @extend keyword and references another selector. The extended selector's attributes are applied to the calling selector. .error { border: 1px #f00; background: #fdd; } .error.intrusion { font-size: 1.3em; font-weight: bold; } .badError { @extend .error; border-width: 3px; } Would compile to: .error, .badError { border: 1px #f00; background: #fdd; } .error.intrusion, .badError.intrusion { font-size: 1.3em; font-weight: bold; } .badError { border-width: 3px; } YES...
View detailed answer →
Question 7: What is the difference between inline, embedded and external style sheets?
Answer: Inline: Inline Style Sheet is used to style only a small piece of code. Syntax: <htmltag style="cssproperty1:value; cssproperty2:value;"> </htmltag> Embedded: Embedded style sheets are put between the <head>...</head> tags. Syntax: <style> body { background-color: primary; } h1 { color: red;&nbs...
View detailed answer →
Question 8: What is the purpose of z-index and how is it used?
Answer: The z-index helps to specify the stack order of positioned elements that may overlap one another. The z-index default value is zero and can take on either a positive or negative number. An element with a higher z-index is always stacked above than a lower index. Z-Index can take the following values: Auto: Sets the stack order equal to its parents. Number: Orders the stack order. Initial: Sets this property to its default value (0). Inherit: Inherits this property from its parent element. Use Z Index if you need to put a background element below a container. You can easily place the background under every elem...
View detailed answer →
Question 9: What is a constraint? and its various types.
Answer: Constraints are the rules enforced on the data columns of a table. These are used to limit the type of data that can go into a table. This ensures the accuracy and reliability of the data in the database. If any interruption occurs between the constraint and data action, the action is failed. Some of the most commonly used constraints are NOT NULL, PRIMARY KEY, FOREIGN KEY, AUTO_INCREMENT, UNIQUE KEY, etc. syntax to create a constraint for a table: CREATE TABLE table_name ( column1 datatype constraint, column2 datatype constraint, ....); SQL cate...
View detailed answer →