[WSG] Tables inside a div
Hi I've a page with div layouts but inside a div I need to show some data inside a table. How could I set table width to be a 90% of div width size ? If I set a table width=90% it takes a 90% of whole page instead of div... Thanks in advance jl ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] Tables inside a div
On 21 Dec 2004, at 9:11 PM, Javier Leyba wrote: How could I set table width to be a 90% of div width size ? If I set a table width=90% it takes a 90% of whole page instead of div... How about div#whatever table { margin: 0 10% ;} But beware... some browsers (IE5Mac comes to mind) need the longhand version div#whatever table { margin-top: 0 ; margin-right: 10% ; margin-bottom: 0 ; margin-left: 10% ; } HTH N ___ Omnivision. Websight. http://www.omnivision.com.au/ ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] Tables inside a div
Just remember - as far as I have found - if you dont set the width on the DIV then the DIV will size to whatever the content is. If you dont have a width on the DIV and say the TABLE is 90% - what will it be 90% of? The closest bounding ancestor area that has a width - which will be the body tag (actually the window object - which is where the body tag gets it dimensions from).. . or something close to that. It you make the DIV 400px wide - then the TABLE will be 90% of that. Or if the DIV is wedged between two other DIVs (like a three column layout) the TABLE will be 90% of whatever is available in that area. Unless the right and left columns are also somehow sizing automatically. There are some dodgy exceptions to this that often mean that if you want a table to fill the available area you use 99% instead of 100% (browser bugs). Regards, Gary ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **
Re: [WSG] Tables inside a div
On Tue, Dec 21, 2004 at 09:50:28PM +1000, Gary Menzel wrote: Just remember - as far as I have found - if you dont set the width on the DIV then the DIV will size to whatever the content is. Not unless floated - if you don't set a width on a non-floated non-replaced block, it will have the width of it's container (-margin,padding,border) - so a div with no width set, will have 100% width - whatever it's content... -- Christian Sonne Stud. scient. math-phys at University of Copenhagen -BEGIN GEEK CODE BLOCK- Version: 3.12 GM/S/CS/O d? s: a---? C++ UL++$ P+ L++ E--- W++ N o@ K? w !O M-- V? PS++(+) PE@ Y-- PGP-@ t+ 5? X++ R@ tv++ b+(++) DI+++ D G@ e+ h! r-(--) y? --END GEEK CODE BLOCK-- http://geeksbynature.dk ** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list getting help **