8 replies [Last post]
krystynak
Offline
newbie
Last seen: 16 years 34 weeks ago
Joined: 2003-12-09
Posts: 5
Points: 0

I'd like to validate my CSS, but the first line creates an error.
If I have <style type="text/css"> at the top of my css file, it gets the following error:

URI : http://www.best-baby-guide.com/StyleSheets/grid.css
Line: 0
Parse error - Unrecognized : <style type="text/css"> #container { width: 760px; margin: 10px; margin-left: auto; margin-right: auto; padding: 10px; }

If I remove that line, the css validates, but my text doesn't flow properly - it stays fixed width. I'd like to flow to different widths when the page is resized. If I put the line back in, it works fine but won't validate (since the style line is not CSS.

Any ideas?

Thanks,
johnk

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 4 days ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

Can't validate CSS

Hi krystynak,
You don't use that declaration in css files, it is only used when embedding the styles directly in the head of the document.
Remove

Quote:
<style type="text/css">
Quote:
</style>


Hope that helps

krystynak
Offline
newbie
Last seen: 16 years 34 weeks ago
Joined: 2003-12-09
Posts: 5
Points: 0

Can't validate CSS

Thanks Tony,

I came to realize that I shouldn't have that in the CSS file,
but when I take it out, it breaks the way laid-out text flows in the browser. Everything gets stuck in static sized columns instead of resizing.

So I'm leaving it in, and everything works in IE. Opera doesn't resize well no matter whether the style tag is in or not.

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 4 days ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

Can't validate CSS

Hi krystynak,
It sounds like you have some other problems in your code.

Can you link to an example page.

krystynak
Offline
newbie
Last seen: 16 years 34 weeks ago
Joined: 2003-12-09
Posts: 5
Points: 0

Can't validate CSS

Here's where my CSS lives:
http://www.best-baby-guide.com/StyleSheets/grid.css

and here's a page that has the layout problem:
http://www.best-baby-guide.com/Car_Seats/index.html

Basically, if I take out the style tag from the .css file, the CSS will validate, but the text column will be static width.

I do believe there is something wrong with my CSS or the way I'm using it, because both Opera and Netscape have presentation issues with many of the pages on my site. Text overlaps across divs. Divs aren't sized properly. You can see this if you open in Mozilla or Netscape 4.7 and resize the width a bit smaller.

I'm going to work on it tonite to try to figure it out. Any pointers would be appreciated.

Thanks,
johnk

dJomp
dJomp's picture
Offline
Enthusiast
Last seen: 4 years 27 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

Can't validate CSS

Given that you declare

#container {
    	width: 760px;
		margin: 10px;
		margin-left: auto;
		margin-right: auto;
		padding: 10px;
}

it works as should when I take the style tags out. All text/images etc are kept in the center of the page.

Maybe a CSS review is in order to see if it's doing what you want it to do!

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.

krystynak
Offline
newbie
Last seen: 16 years 34 weeks ago
Joined: 2003-12-09
Posts: 5
Points: 0

Can't validate CSS

Thanks for the help.

I started from scratch again, and I realize that the "width" property
was a problem...

I also changed to using Import url to get the style sheet in.

CSS programming is like any kind of programming I guess, you
should "plan to throw one away". Of course, the fact that you have
many browsers to deal with makes it a bit confusing at first - just because everything "worked" in IE, didn't make it correct...

My new stylesheet is at:

http://www.best-baby-guide.com/StyleSheets/tri.css

SPI
Offline
newbie
South Texas
Last seen: 16 years 37 weeks ago
South Texas
Joined: 2003-11-22
Posts: 9
Points: 0

Can't validate CSS

Just a minor thing off topic of validation! I would change to text size of Baby products smaller because the div expands and makes the container rather large which cuts down on your main content. More to get it closer to the add size container on right side for better balance. Wink

krystynak
Offline
newbie
Last seen: 16 years 34 weeks ago
Joined: 2003-12-09
Posts: 5
Points: 0

Can't validate CSS

Thanks SPI, I agree, I need to do some aesthetic clean up. Sizes and colors. You are definitely right about the left side bar, and the overall balance.

My first attack, though, was to get the layout reasonable and correct - I'm learning as I go. Today I'm going to work on the CSS for the rest of the pages... Also have to work on content! The list goes on..