I have a container set to 960px with 20px of padding, and a div set to 100% inside of that. Now, my question is: how can I force the div to take up 100% of the container from edge to edge even though I have set a padding?
I know how to do it, just want to make sure I’m doing it the best way possible.
Though, word of advice – NEVER set padding the same time as a fixed width, too much of a pain in one’s backside. Side-Margin or pad the child elements instead of padding the parent… It’s just less headaches all around.
Especially if you’re still expected to support the page being usable back to 5.5 (doesn’t have to be perfect, just has to be usable) with the ‘broken’ box model.
You would need to remove the 100% width and let the width be auto and then use negative margins of -20px on each side. For ie7 and under you will also need to add position:relative and zoom:1.0 or the element won’t behave properly.