The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
I'm trying to add coloured borders (left and right) to my site. So I give my body tag a colour, then make my wrapper/container white.
Now how do I create a margin between the background colour and the content so they arent right next to each other?
Usually I would just add
padding: 10px;
to the wrapper div and add 20px to the width. But for some reason this doesnt work anymore.I'm pretty sure it use to be...
content + padding = width
Using
margin
will only create space outside the container so it'll still place the content right next to the background. Plus I'm already using margin-left: auto; margin-right: auto;
which I use to centre the wrapper (is this how everyone does it now?)So yeah I'm stuck and starting to get a headache. Should I stick with the 10px padding or use something else? I want to do it the right way and not the "this will do for now" way.
Any help much appreciated.
Where one applies padding on top of the original width, the other one doesn't.
I believe you'd need two wrappers, one a fixed width, then another with width 100% and padding, for example:
I've used inline styling so it's easier to work out which styling is applied to which element.
<body style="background: #666; margin: 0; text-align: center;">
<div style="width: 1000px; background: #FFF;">
<div style="width: 100%; padding: 0px 10px 0px 10px;">
Content here
</div>
</div>
</body>
I'm sure there's an IE hack you can use, or that Garin/Eccles will find a better solution. But I'm confident that will work.
I'm trying to add coloured borders (left and right) to my site. So I give my body tag a colour, then make my wrapper/container white.
Now how do I create a margin between the background colour and the content so they arent right next to each other?
Usually I would just add
padding: 10px;
to the wrapper div and add 20px to the width. But for some reason this doesnt work anymore.I'm pretty sure it use to be...
content + padding = width
Using
margin
will only create space outside the container so it'll still place the content right next to the background. Plus I'm already using margin-left: auto; margin-right: auto;
which I use to centre the wrapper (is this how everyone does it now?)So yeah I'm stuck and starting to get a headache. Should I stick with the 10px padding or use something else? I want to do it the right way and not the "this will do for now" way.
Any help much appreciated.