Solved

CSS padding around table that is inside box

Posted on 2008-10-27
5
557 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article discusses four methods for overlaying images in a container on a web page
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now