Advertisement

09.26.2008 at 09:22AM PDT, ID: 23766599 | Points: 500
[x]
Attachment Details

Making a DIV just big enough, but not too big

Asked by gdemaria in Cascading Style Sheets (CSS)

Tags: ,

I have a table that has a variable width.  Based on the size of the data in the columns, the table can range from say 650px to 840px.   I have a DIV that surrounds this table.  The intent of the div is to add a simple border around the table (and some other objects like a heading and some text).  

How can I defined my DIV's width so that it is the size of the table, plus say 10px padding?
If I use width:auto or no width, the div is the size of the entire page.  If I specify the exact width, then sometimes there is too much of a margin around the table.

Thanks!!Start Free Trial
[+][-]09.26.2008 at 04:32PM PDT, ID: 22584785

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.26.2008 at 04:53PM PDT, ID: 22584866

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.26.2008 at 05:35PM PDT, ID: 22585044

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_EXPERT_20070906