I would like to calculate the width of child-container (div etc) in percentages depending on the parent container with LESS CSS.
I am using the forumula by Ethan Marcotte: target / context = result.
Parent container: 620px
Child container: 140px
I am using this calculation:
div.child-container {
width: (140/620)*100%;
}
However the output is:
div.child-container {
width: 0.2258064516129;
}
I would like to move the decimal point two digits and add the %, like this:
div.child-container {
width: 22.58064516129%;
}
Any hints greatly appreciated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…