0

I want to include the styles of four classes in one. And add some more style. I am not too sure about SCSS. Is this the right way to do it?

.react-datagrid {
  @extend .table;
  @extend .table-striped;
  @extend .table-bordered;
  @extend .table-condensed;
  display: flex;
}

2 Answers 2

1

it is, as you can see in this jsfiddle : https://jsfiddle.net/0nptv6sf/1/

HTML :

<div class="react-datagrid">test</div>

SCSS :

.table {
  color: red;
}

.table-striped {
  font-size: 10px;
}

.table-bordered {
  background-color: black;
}

.table-condensed {
  padding: 10px;
}

.react-datagrid {
  @extend .table;
  @extend .table-striped;
  @extend .table-bordered;
  @extend .table-condensed;
  display: flex;
}
Sign up to request clarification or add additional context in comments.

1 Comment

thanks for fiddling it out. not sure about scss. was thinking of some other keyword other than extend.
0

#Another concept here

#single css .table { color: red; }

.table-striped {
  font-size: 10px;
}

.table-bordered {
  background-color: black;
}

.table-condensed {
  padding: 10px;
}

for extend multiple class overwrite or extend

.element {
   @xtend .table; 
   @extend .table-striped;
   @extend .table-bordered;
   @extend .table-condensed;
}

it's better than prev extend

.element {
    @extend #{'.table', '.table-striped', '.table-bordered','.table- 
              condensed',....'.class-n'};
    // ohters css here
}

It's simple and works fine, just u add inside the second curly brasses.

===Thank you===

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.