M
M
mr_blond972017-02-22 20:28:37
css
mr_blond97, 2017-02-22 20:28:37

How to apply a class only to the first child of an element in less?

On the less screen, property width:200px; applies to all divs in the "parent" class. Tell me how to apply the class in less not to all divs, but only to the first child "child_1"?
5feb423116581a3fd1a3e4af7dfa5542-full.pn

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
iBird Rose, 2017-02-22
@mr_blond97

.parent {
  >div {width: 200px;}
}

G
Gleb BYR, 2017-10-31
@GlebBYR

www.prntscr.com/h4azjm
ZhGl_1fPTfS2VNeUSLKmGQ.png

M
M-ka, 2017-10-31
@M-ka

didn't use classList.add to add before, so I can't say, setAttribute class/className instead (latest for old IE)

E
Eugene, 2017-10-31
@EShein

How is it not if there is. Function not found says... In the script settings, select no Wrap in head.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question