R
R
rtfm mftr2016-04-09 12:35:03
css
rtfm mftr, 2016-04-09 12:35:03

What is the best way to write text rules in CSS?

Which option is better?
1. The idea is to list all classes that need the same text property values. and take them out, for example, into a separate file in SASS.

//семейства
.main-header, .logo, .section-header, .link-social ... {  font-family:  Raleway }
.sub-header, .another-header, .link-nav ... { font-family:  Helvetica }
.plain-text, .article-header, .link-outer ... { font-family:  Arial  }
// начертания
.main-header, .logo { font-weight: 700 }
.section-header, .sub-header, .another-header, .link-nav, .plain-text { font-weight: 600 }
//размеры, стили аналогично

2. Everything is as usual, copy-paste in each class
.main-header { font: 4em 700 italic Raleway}
.logo { font: 3 em  700 Raleway}
.section-header { font: 2em/.5em 600  italic Helvetica}
.link-social { font: 1.6em 600  Raleway}
//и так далее

In the first copy-paste of class names separated by commas, and in the second rules. What is better/worse?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Inchin ☢, 2016-04-09
@rtfmmftr

list all classes that need the same text property values

%_font-Arial{
  font-family:  Arial;
}

%_font-Weight{
   font-weight: 600;
}

@import "Pattern";

.class{
  @extend %_font-Weight, %_font-Arial;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question