Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 9th, 2005, 01:34 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Fairfield, Iowa, USA.
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
  #2 (permalink)  
Old April 9th, 2005, 06:56 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
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
  #3 (permalink)  
Old April 9th, 2005, 10:33 AM
Friend of Wrox
 
Join Date: Jun 2004
Location: Fairfield, Iowa, USA.
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
  #4 (permalink)  
Old April 11th, 2005, 11:01 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:14 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.