?
Solved

CSS padding around table that is inside box

Posted on 2008-10-27
5
Medium Priority
?
608 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 300 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
Suggested Courses
Course of the Month8 days, 16 hours left to enroll

764 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