julie.c.web
julie.c.web
KPCKevin Powell - Community
Created by julie.c.web on 1/17/2024 in #front-end
Responsive container : max-width or padding ?
Hi, When I create a website, I usually use <section class="container"></section> and .container {width:100%; padding: 7rem calc((100% - 1280px)/2);} and then media queries such as @media only screen and (max-width: 1280px){ .sct_container {padding: 5rem 8%;} @media only screen and (max-width: 992px){ .sct_container {padding: 4rem 5%;} @media only screen and (max-width: 768px){ .sct_container {padding: 4rem 5%;} Looking at Kevin's course, it seems to be that way <section><div class="container"></div></section> Then .container {max-width:1280px; margin : 0 auto; width:80%;} I don't understand some things. Like why is it a better way to add an extra div ? And is there something wrong with my way of doing things ? Yous explainations would help me being better, so thanks !
3 replies