GetDotted Domains

Viewing Thread:
"CSS Wrapper problem"

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.

Mon 14/07/08 at 12:57
Regular
Posts: 19,415
Okay I'm really stuck and I need some help.

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.
Mon 14/07/08 at 22:30
Regular
"Devil in disguise"
Posts: 3,151
I take it this has been fixed?
Mon 14/07/08 at 21:15
Regular
Posts: 19,415
Thank you very much McLong :D, I think I'll use that.
Mon 14/07/08 at 13:35
Regular
Posts: 791
I think IE and FF treat this differently.

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.
Mon 14/07/08 at 12:57
Regular
Posts: 19,415
Okay I'm really stuck and I need some help.

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.

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Very pleased
Very pleased with the help given by your staff. They explained technical details in an easy way and were patient when providing information to a non expert like me.
LOVE it....
You have made it so easy to build & host a website!!!
Gemma

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre
Feedback Close Feedback

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.