Wrox Programmer Forums
|
BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3
This is the forum to discuss the Wrox book Beginning CSS: Cascading Style Sheets for Web Design by Richard York; ISBN: 9780764576423
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 9th, 2005, 01:34 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 16

Richard,
table.recipe {
width: 100%;
margin-bottom: 5px;
}

On page 442 you have the following explanation for the above rule:
 
Quote:
quote:Here the table is told to take up 100% of the available space horizontally


I have been unsure about what widht: 100% actually does, is it that tells the contained object to take up all free space available horizontally, or actually assigns the same width as the containing object?

You also say:
Quote:
quote:A margin is applied to the bottom of the table to provide more spacing from the end of the <table> and the start of the[list].
but the[list] is part of the table? Am I missing something?

Thanks

Christian
__________________
Christian
 
Old April 9th, 2005, 06:56 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

I use those explainations interchangably sometimes. Percentage width is _always_ based on the width of the containing element. Tables have a unique interpretation of width that is all their own though, as you no doubt saw with the table-layout property. They don't always honor explicit widths, unless explicitly told to do so (e.g. table-layout: fixed;).

I think at one time the[list] was outside of the table. In fact, it is outside of the table in Chapter 17, which is probably where I got that from. It should actually be "more spacing from the end of the recipe body contained in the <tbody> element, and the start of the[list] in the <tfoot> element".


Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
 
Old April 9th, 2005, 10:33 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 101
Thanks: 0
Thanked 0 Times in 0 Posts
Default

 
Quote:
quote:Percentage width is _always_ based on the width of the containing element

which means that if a contained element has: width: 100%, and the containing element had: width: 200px;, it will assign to the contained element a width: of 200 px and not as much as space available, right?

 
Quote:
quote:It should actually be "more spacing from the end of the recipe body contained in the <tbody> element, and the start of the[list] in the <tfoot> element".


but if that was the case shouldnt the margin-bottom: 5px; be moved to the tbody, something like:

table.recipe {
width: 100%;
}
table.recipe tbody{
margin-bottom: 5px;
}

A side question: Is there an easy way to align vertically a block element that is contained within another block element.

Christian
 
Old April 11th, 2005, 11:01 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default


> which means that if a contained element has: width: 100%, and the containing element had: width: 200px;, it will assign to the contained element a width: of 200 px and not as much as space available, right?

Yes, you're right about it not being the space available to it, but to clarify a point, tables follow a completely different set of rules. They only follow explicit widths when it is convienient to do so. If you provide a table with a width of 100% and the containing element has a width of 200 pixels, the table will have a width of 200 pixels, unless the content in the cells of that table add up to more than 200 pixels, in which case it will overflow the boundaries of the containing element (e.g. add up to greater than 200 pixels). In that light widths on table elements are more like minimum widths, they stretch if the content is larger than those widths allow. That is until you apply the table-layout: fixed; declaration to the table, in which case any defined widths are explicitly and strictly adheared to.

Second question, I haven't yet evaluated this example, I suspect my error is only in the explanation and not in the example itself. This example was designed to mirror pixel for pixel the XML based version of the same recipe that is presented in Chapter 17, so I don't think the margin should be moved.

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 16 Fig 16-11 krsouthern BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 1 July 8th, 2008 12:11 PM
Chapter 16 boyce0324 VB.NET 2002/2003 Basics 1 June 5th, 2007 01:59 AM
chapter 16 ?? farsfar2 BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 11 March 26th, 2005 10:01 PM
Chapter 16 ioda006 JSP Basics 3 August 21st, 2004 07:28 PM
Help in Chapter 16 aldwincusi VB.NET 2002/2003 Basics 2 June 4th, 2003 09:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.