4 ms·
What is the padding for? Doesn't make a difference for me.
by kelukelugames 11y ago
What is the padding for? Doesn't make a difference for me.
- oliv__ 11y agoMobile.
- kelukelugames 11y agoCan you please explain? I want to improve on CSS, but have under developed eye for design.
- theIV 11y agoIf you don't add padding, the text will touch the very edge of the screen when in a mobile browser. [edit] see oliv__'s response, it's more detailed than mine :)
- 50CNT 11y agoThis stuff belongs in the domain of graphical design. Rule of thumb is to provide padding towards the edges around text, a little more to the sides than to the top, eg. [padding: 1em 2em;] depending on the font used because of inherent vertical padding in writing. If the text hugs the container, it seems cramped, and we get distracted by the lines of the bounding container. I recommend giving "The Elements of Graphic Design" by Alex W. White a read, where he talks about issues of space and typography and why certain conventions exist. CSS is after all a way to express graphical design relations in code, which isn't very useful if one is unaware of the principles driving clear and useful design.
- oliv__ 11y ago@kelukelugames Sure. The padding adds 15px of space on both sides of the body so that the text doesn't "stick" to the edges when the size of the screen is less than the defined max-width (i.e: on mobile). Doesn't make a difference on desktop though.
- kelukelugames 11y agoThank you! Now I don't have to use Bootstrap on every site I make. :)