 |
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
|
|
|
|

May 2nd, 2006, 04:57 PM
|
|
Friend of Wrox
|
|
Join Date: Apr 2005
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Position: *fixed* keyord, offered / not offered
This is not a complaint about the book.
I was messing around with the 'position: fixed' keyword as in Chapter 14 on page 404. I'm using plain vanilla IE6 and Visual Web Developer 2005 Express.
On one hand:
In the following line I wanted to specify 'fixed' position in a div as follows:
<style="position:fixed;"
However, as soon as I typed the colon after position, intellisense offered me
only these three choices: absolute, relative, and static. While I typed it in above,
the compiler never actually permitted or accepted the 'fixed' as shown above.
On the other hand:
If I use a link to a css and in the css specify the nav div as follows,
div#nav{position:fixed; right: 0; left:0;}
As soon as I type the colon after position,intellisense offered me five choices:
inherit, absolute, fixed, relative, static.
Complete code here for both cases:
--------------------using code style parameter and not a style sheet------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
</head>
<body>
<div style="position:fixed;">Navbar</div> [[[Does not offer 'fixed']]]
</body>
</html>
[[[Note: the word fixed in the div is flagged as an error ]]]
-----------------using a style sheet----------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<link rel="Stylesheet" href="StyleSheet.css" type="text/css" media="screen" />
<title>Untitled Page</title>
</head>
<body>
<div id="nav"></div>
</body>
</html>
[[[stylesheet]]]: div#nav {position:fixed;}
--------------------------------------------------
Anyone have an idea why I get 3 choices in one case and 5 in the other?
--------------------------------------------------
Excluding cascade order, up till now I assumed you could put style in the code using the
style="" parameter in the xhtml, or you could use a style sheet. But whichever you used, you had the exact same choices and functionality.
Unless I am making a mistake, you do NOT get the exact same choices and functionality !!!
Anyone set me straight on this??? Thanks.
VV
|
|

May 3rd, 2006, 11:20 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2005
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Rich:
Thanks. As I said I was not complaining about the book.
The good news is that plain vanilla IE6 on my machine does support fixed positioning as shown above.
In order to make it work I simply used/linked to a separate style sheet to specify it.
After thinking about the difference I detailed above, my assessment of the situation is that the MS VWD Express development environment does not support 'position: fixed',as you suggested. That is why intellisense does not offer it.
But fortunately:
When creating the css code, intellisense does offer 'fixed'. And, at run time IE6 does render the 'fixed' specification correctly.
Regards,
VV
|
|

May 3rd, 2006, 11:31 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
|
|
|
|

May 3rd, 2006, 11:45 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
|
|
BTW, if you want fixed positioning in IE, which it does not support, unless you've by chance managed to stumble onto something *thousands* of developers and Microsoft itself have missed over the past five years that IE6 has been out, have a look at this page:
http://annevankesteren.nl/test/examp...ion-fixed.html
This is an extremely elegant and simple solution for enabling fixed positioning in IE (view source).
It uses the IE underscore filter to prevent other browsers from seeing the IE-only, garbage CSS. Essentially if you prefix properties with an underscore, IE6 will see them and other browsers won't, but it's not standard CSS.
These hacks ought to be in conditional comment sequestered style sheets instead of polluting the style sheets that all browsers can see, one reason being the upcoming IE7 browser does support fixed positioning. But, I leave that to you to decide.
http://msdn.microsoft.com/workshop/a...omment_ovw.asp
Regards,
Rich
--
Author,
Beginning CSS: Cascading Style Sheets For Web Design
CSS Instant Results
http://www.catb.org/~esr/faqs/smart-questions.html
|
|

May 3rd, 2006, 03:25 PM
|
|
Friend of Wrox
|
|
Join Date: Apr 2005
Posts: 190
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yup, you're right Rich:
Been playing around all afternoon with IE6 trying to get it to fix a div position.
Can't do it.
I was able to fix a background image, and figured if it works for a background image
then it oughta work for a div.
At design time I get intellisense offering to *fix* both the background-attachment
and for div position fixed. But at run time, div position fixed just doesn't happen.
Also read up a bit on MS IE7 beta where the fixing problem and the direct descendent and sibling selectors have been included. So things are looking up for IE.
Thanks for the guidance.
VV
|
|
 |