 |
| CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS). |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the CSS Cascading Style Sheets 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
|
|
|
|

August 18th, 2006, 01:31 PM
|
|
Registered User
|
|
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
CSS Parse Error
I recently bought Professional CSS from WROX (and excellent it is). I am trying to implement a technique from Chapter 3 and am getting a strange CSS Parse error.
The rule below:
div#body {
margin:auto;
width: 710px;
}
generates the following parse error in W3C CSS validator and the rule settings do not take effect in my HTML, although other rules from same stylesheet do.
* Line: 19 Context : CSS
Parse Error - div#body { margin:auto; width: 710px; }
Can anybody see the problem?
Many thanks,
Denis
|
|

August 18th, 2006, 01:47 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Hi! :)
As you can see if you validate that single rule, there is nothing wrong with it. Possibly it isn't a good idea to use an element name as the name of an id, but that's beside the point.
http://jigsaw.w3.org/css-validator/v...usermedium=all
So, could you please post the URL to the whole style sheet instead?
--
http://yupapa.com
|
|

August 18th, 2006, 02:36 PM
|
|
Registered User
|
|
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
It's a local file on my Mac but here's the stylesheet
Many thanks,
Denis
PS I agree with you re using an element name but I was trying to understand teh basic technique so I just mimicked the book. Incidentally, I have tried changing the class name but to no effect.
Regards,
Denis
CSS
/* this CSS comes from the beginning of the Blogger example in Chapter 3 of Professional CSS and allows main and sidebar divs to swap over left and right*/
/* this following div constrains everything to a certain width and provides room for the two contaimed <divs> to sit side by side. Auto property for margins centers the content*/
/*The CSS Validator at W3C produces the following error message: To work as intended, your CSS style sheet needs a correct document parse tree. This means you should use valid HTML.
Errors
URI : file://localhost/FlexiSidebar.css
* Line: 13 Context : CSS
Parse Error - div#body { margin: auto; width: 710px; font-size: small; font-family: verdana tahoma arial,sans-serif; } */
div#body {
margin:auto;
width: 710px;
}
/* default setting for sidebar - will not display and will be removed from flow unless a class is specified in the body tag All the CSS from here to end of file works allowing me to switch positions between Main and Sidebar left/right/no sidebar... However the rule above is not styling Body. Why not?*/
div#sidebar {
display: none;
}
/* and here is the styling if such a class is specified, constraining #main to a certain width to make room alongside for the sidebar*/
body.ms div#main,
body.sm div#main {
width: 490px; /* redesign this to ems*/
}
/* similarly setting the styling for #sidebar in such a circumstance*/
body.ms div#sidebar,
body.sm div#sidebar {
display: block; /* and this counteracts the display: none default style for the sidebar above*/
width: 200px; /* redesign this to ems */
}
/* having set up the styling the next two rules position sidebar left or right */
body.ms div#main,
body.sm div#sidebar {
float: left;
}
body.sm div#main,
body.ms div#sidebar {
float: right;
}
|
|

August 18th, 2006, 03:30 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
|
|
|
|

August 18th, 2006, 04:29 PM
|
|
Registered User
|
|
Join Date: Aug 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I assumed it would validate as I admit that it's actually yours, but what I can't understand is why it doesn't validate and that first rule doesn't take effect.
Regards,
Denis
|
|

August 18th, 2006, 04:56 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
It can be something else. An illagal character for instance. Put it on a web server and see what happens.
--
http://yupapa.com
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Parse error: syntax error, unexpected T_ELSE in /h |
vipin k varghese |
BOOK: XSLT Programmer's Reference, 2nd Edition |
4 |
September 29th, 2011 01:19 AM |
| Ch 4: Parse error: syntax error, unexpected T_SL |
hanizar77 |
BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 |
0 |
June 23rd, 2008 09:17 PM |
| PHP Parse error: parse error, unexpected T_STRING |
geminient |
PHP How-To |
4 |
August 18th, 2007 02:27 AM |
| Parse error: parse error, unexpected $end |
Ayodeji Adegbaju |
Pro PHP |
3 |
January 12th, 2007 12:21 PM |
| Css Parse error |
manimoo |
CSS Cascading Style Sheets |
1 |
October 14th, 2006 10:18 AM |
|
 |