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 October 7th, 2005, 07:04 AM
Registered User
 
Join Date: Aug 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default HTML tag vs Body Tag

Hi -

I'm a bit confused about creating styles that affect the outermost "wrapper" of your web page. On page 124 of the book, the HTML tag is given the style definition that causes the thick black frame around the page content. (This is done through use of the :root pseudo-class, but I'm guessing that the effect would be the same if I just referenced the HTML tag in the style definition). I would have thought that the body tag would have been the tag to reference to get this effect. (In fact, there might have been an example in the book where the body tag was used.) I think of the HTML tag as unrelated to web page display. Is there a difference between using body vs html tag? If so, can anyone tell me what?

 
Old October 7th, 2005, 07:13 AM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

I can't think of any differences. You have to reference the <html> tag on occaision though. For instance, if you want to set the height of the <body> element to 100% of the viewport, the <html> tag must also be set to 100%. That has to do with the shrink-to-fit height sizing algorithm specified in the CSS standards.

The :root psuedo-class isn't very useful in HTML because you *can* reference the <html> tag directly. Where it becomes useful, and the reason for it existing as far as I can tell, is in XML where the root element can be variable, and not always the same tag.

Hope that answers your question.

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
HTML tag problem Aker C# 7 April 22nd, 2008 11:04 AM
HTML tag from C# or ASP.NET tag from javascript angshujit ASP.NET 2.0 Basics 3 February 16th, 2007 10:07 AM
Properties in Body Tag - Pg. 40/41 jabs BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 December 5th, 2006 09:12 AM
Evaluating body content of a custom tag Tag Librarian Pro JSP 0 May 13th, 2005 02:40 PM
body tag in an include page Adam H-W Javascript 8 April 29th, 2004 03:03 AM





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