Responsive Width Calculation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Responsive Width Calculation

How to calculate for different responsive box? if width container was 100%, the box in it should be how much %?

19th Nov 2016, 5:32 AM
Rusydi Hasan
Rusydi Hasan - avatar
6 Answers
+ 1
https://code.sololearn.com/Wi0l1NKqOxlf as you and I can see it's okay) In case you want to use borders you should use box-sizing css rule (or reduce width). Alternative variant (no floats, display: table) https://code.sololearn.com/WxRE9Wktwuow Alternative variant (no floats, not tables, flexbox (for more modern browsers)) https://code.sololearn.com/WPRtlH2y0y0b
19th Nov 2016, 7:54 AM
Ivan G
Ivan G - avatar
+ 1
Thank you, that's really help me.
19th Nov 2016, 9:05 AM
Rusydi Hasan
Rusydi Hasan - avatar
0
Well, as for me, I can't understand what do you want
19th Nov 2016, 6:09 AM
Ivan G
Ivan G - avatar
0
I mean like this. .container{width: 100%;} .main-item{width: 75%, float: left;} .sidebar{width: 25%, float: right;} in HTML I put <div class="container"> <div class="main-item"></div> <div class="sidebar"></div> </div> Is it ok for width?
19th Nov 2016, 6:23 AM
Rusydi Hasan
Rusydi Hasan - avatar
0
You should replace commas (",") with semicolons (";") in your css.
19th Nov 2016, 6:27 AM
Ivan G
Ivan G - avatar
0
ya ya ya I know it is my fault, but how about the width? is it ok?
19th Nov 2016, 6:44 AM
Rusydi Hasan
Rusydi Hasan - avatar