Solved

CSS padding around table that is inside box

Posted on 2008-10-27
5
577 Views
Last Modified: 2012-06-27
Is there any way of adding padding around a table and with the table inside a box (with a border) using CSS. I have tried lots of diferent ways and I'm stuck. I'm trying to create the look of the old html table inside a table so that I can get a thin border, but have white space between the inside table and the ouside border. Thanks
0
Comment
Question by:ruthie2012
  • 3
  • 2
5 Comments
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 22819238
If you are using a DIV to enclose the table, that will be your problem, if just tables, there is no problem.
0
 

Author Comment

by:ruthie2012
ID: 22829147
Thanks for your response.
Can I enclose the outside box in a div?
On my page I have a maincontainer div that is 600px wide. All I want to do is have say 3 or 4 equal sized and spaced boxes across and 2 or 3 rows down. I'm trying to do it without tables but I would like to include a table in some of the boxes. I can't attach any code because it's rubbish - not working at all. Please could you point me in the right direction. Thanks.
0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 22837312
The DIV around a table will give you problems, no matter what you do.  To fix the DIV at 600, you have to then calculate the table at 600- all the padding in the table, and it is a NEEDLESS pain in the neck.  

"I mean doesn't the browser automaticly figure that the page should be viewed in the whole window if possible? "

If you want tables, then USE them and get rid of the DIV around them.  If you insist on putting a DIV around a table, your HTML will not work until you figure out how different they are.

If you want a table with equal sized table cells, leave it as a table -- the DIV will FOUL it up !!!
0
 
LVL 44

Accepted Solution

by:
scrathcyboy earned 100 total points
ID: 22837320
the quote about was meant to be from your post -- an EE problem --
"I'm trying to do it without tables but I would like to include a table in some of the boxes."
0
 

Author Comment

by:ruthie2012
ID: 22839082
Thanks scrathcyboy. I'll stick with the table!!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question