PDA

View Full Version : valid css


Tazuk
7th February 2006, 09:09
Ok i have just done a w3c check on my css and it has reported no errors but several warnings, mainly about no background colours etc. Does this mean it is valid w3c css or do i have to change the warnings?

TAZ

Mortime Business Software
7th February 2006, 09:46
Ok i have just done a w3c check on my css and it has reported no errors but several warnings, mainly about no background colours etc. Does this mean it is valid w3c css or do i have to change the warnings?

TAZ

Yes, I would say that it is valid, but in programming it is generally accepted that warnings should be eliminated if possible. This is because warnings can easily turn into errors with further development, and can make debugging more difficult.

I'm not a CSS expert, but I would guess that this notion of validity is the same for CSS. If you're a perfectionist, which is a good thing to be when instructing a machine, I would fix them up.

Dave

DavidHorn
7th February 2006, 10:34
As Dave says, it's valid - however, it's always worth addressing warnings. If you have the 'look at me, I have valid CSS on my site' link at the bottom of your page, for instance, and someone clicks on it - all those warnings will make people go 'huh?'

Also, as browsers develop they may get less tolerant of errors, so it's better to have them fixed from the get go.

Coding Monkey
7th February 2006, 10:41
The warnings almost always consist of 'you have no background-color on this.....' when that's the point of ID's, to override needing it for every damn class, and span and blah blah. If browser change that, then CSS just takes steps backwards. If we have to define everything in CSS, we may as well go back to using tables, as instead of changing 1 line, we have to change them all, unless we start using inherit, and then I don't see the point of that.

My advice: don't bother. And I'll wait for the revolt right about....now ;)

Tazuk
7th February 2006, 10:54
What would be the best course of action for the following:

Line : 19 (Level : 1) You have no background-color with your color : a:hover
Line : 19 (Level : 1) You have no background-color with your color : a:hover
Line : 19 (Level : 1) You have no background-color with your color : a:hover
Line : 25 (Level : 1) You have no background-color with your color : a:hover
Line : 38 (Level : 1) You have no background-color with your color : h1
Line : 43 (Level : 1) You have no background-color with your color : h2
Line : 48 (Level : 1) You have no background-color with your color : h3
Line : 54 (Level : 1) You have no background-color with your color : h4
Line : 59 (Level : 1) You have no background-color with your color : h5
Line : 76 (Level : 1) You have no background-color with your color : label
Line : 91 (Level : 2) You have some absolute and relative lengths in margin. This is not a robust style sheet.
Line : 93 (Level : 1) You have no color with your background-color : #navBar
Line : 102 (Level : 2) You have some absolute and relative lengths in padding. This is not a robust style sheet.
Line : 103 (Level : 1) This property applies to block-level elements. : #content
Line : 129 (Level : 1) You have no background-color with your color : #globalNav
Line : 131 (Level : 1) This property applies to block-level elements. : #globalNav
Line : 164 (Level : 1) This property applies to block-level elements. : .feature h3
Line : 193 (Level : 1) You have no background-color with your color : #siteInfo
Line : 258 (Level : 2) Redefinition of voice-family : #sectionLinks a:link
Line : 259 (Level : 2) Redefinition of width : #sectionLinks a:link
Line : 269 (Level : 1) You have no color with your background-color : #sectionLinks a:hover

I dont want any background colours as is said above, and the page works with no reported errors.

Cheers

TAZ

Mortime Business Software
7th February 2006, 12:33
If we have to define everything in CSS, we may as well go back to using tables, as instead of changing 1 line, we have to change them all, unless we start using inherit, and then I don't see the point of that.

My advice: don't bother. And I'll wait for the revolt right about....now ;)

Tom. I just read a little tutorial on CSS 'inherit'.

http://www.creativepro.com/story/feature/14776.html

I didn't read it thoroughly, and you have probably forgotten more than I know about CSS, but I sort of saw the sense in this inheritance mechanism, and the author reckons it's a pretty powerful tool if used cleverly enough. He also suggests that you don't have to choose between tables and CSS (as you suggested), but rather that you can use tables with CSS.

However, as you've probably gathered by now, I am not one who listens to opinions without "revolt" :). So my question to you is, why do you think there is no point in using inheritance?

At the moment I am leaning towards using inheritance to eliminate the warnings (on my own site) because, in my experience (not including CSS), warnings can have a nasty habit of coming back to bite you with errors. Again, I don't know enough about CSS to imagine how this could happen, but I just like to be thorough.

My reasoning for heeding these warnings is that I cannot imagine the developers of the CSS system giving any warnings if they were not necessary, or we did not need to know about them. I mean, what is the point of alerting us to certain things if we don't need to know about them?

Dave

Coding Monkey
7th February 2006, 12:47
I meant the CSS tag, inherit. Not inheritance. That article's not related to what I was discussing, as that article will actually cause the warnings (please note, not errors). Everything you just said actually will cause the warnings. And yes, you can use tables, but that article doesn't cross me as exactly new. Plus, you have more power when not using tables for SPECIFIC layouts, which is the majority now. Otherwise, you have to end up with absolute positioning.

Now, if these warnings were really that bad, do you think the WC3 would have them in their own documents? No? Oh, that's interesting, cos they do.

http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fw3.org&usermedium=all

Mortime Business Software
7th February 2006, 13:38
I meant the CSS tag, inherit. Not inheritance. That article's not related to what I was discussing, as that article will actually cause the warnings (please note, not errors). Everything you just said actually will cause the warnings. And yes, you can use tables, but that article doesn't cross me as exactly new. Plus, you have more power when not using tables for SPECIFIC layouts, which is the majority now. Otherwise, you have to end up with absolute positioning.

Now, if these warnings were really that bad, do you think the WC3 would have them in their own documents? No? Oh, that's interesting, cos they do.

http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fw3.org&usermedium=all

Sorry if I'm annoying you Tom. Please bear with me because like I said, I know next to nothing about CSS.

From my very basic understanding, I have it that CSS has classes, properties and values. I have also read that "inherit" is a "value" which can be given to properties which are inheritable, and which is used to implement "inheritance" for HTML pages and their tags.

I have searched for definitions of "inherit tag" and "css inherit tag" but I can't find any, (although I admit it wasn't a very thorough search). So my question here is, what is an 'inherit' tag, or more generally, what is a CSS tag?

I'm not having a pop at you. I try to learn tidbits from people like you because I don't have the time to persue them more thoroughly for myself at certain times.

Thanks in advance for your help.

By the way, if you want to ask me a question, I would like to answer it myself, and not have you answer it for me. ;) The fact that the W3 page has warnings does not mean that I should like them or lump them in my pages.

Dave

Jayne
7th February 2006, 13:47
What would be the best course of action for the following:

Line : 19 (Level : 1) You have no background-color with your color : a:hover
Line : 19 (Level : 1) You have no background-color with your color : a:hover
Line : 19 (Level : 1) You have no background-color with your color : a:hover
Line : 25 (Level : 1) You have no background-color with your color : a:hover
Line : 38 (Level : 1) You have no background-color with your color : h1
Line : 43 (Level : 1) You have no background-color with your color : h2
Line : 48 (Level : 1) You have no background-color with your color : h3
Line : 54 (Level : 1) You have no background-color with your color : h4
Line : 59 (Level : 1) You have no background-color with your color : h5
Line : 76 (Level : 1) You have no background-color with your color : label
Line : 91 (Level : 2) You have some absolute and relative lengths in margin. This is not a robust style sheet.
Line : 93 (Level : 1) You have no color with your background-color : #navBar
Line : 102 (Level : 2) You have some absolute and relative lengths in padding. This is not a robust style sheet.
Line : 103 (Level : 1) This property applies to block-level elements. : #content
Line : 129 (Level : 1) You have no background-color with your color : #globalNav
Line : 131 (Level : 1) This property applies to block-level elements. : #globalNav
Line : 164 (Level : 1) This property applies to block-level elements. : .feature h3
Line : 193 (Level : 1) You have no background-color with your color : #siteInfo
Line : 258 (Level : 2) Redefinition of voice-family : #sectionLinks a:link
Line : 259 (Level : 2) Redefinition of width : #sectionLinks a:link
Line : 269 (Level : 1) You have no color with your background-color : #sectionLinks a:hover

I dont want any background colours as is said above, and the page works with no reported errors.

Cheers

TAZ


Sorry to interrupt, but do you mind answering Taz's question, then you can carry on with your bickering :lol:

Ta

Jayne

Mortime Business Software
7th February 2006, 14:04
Jayne. Who's bickering? This debate *is* answering Taz's question.

Taz wants to know if he should try to get rid of the warnings. I say yes, Tom says no. When the debate is finished, Taz can then make his mind up on the opinions and evidence he extracts from the messages.

Dave

Jayne
7th February 2006, 14:06
Not that bit Dave, the bit I copied..up there (don't know where the arrows are) :lol:

I think you missed his post.

Jayne :D

Tazuk
7th February 2006, 14:12
Actually i have now sorted it and got rid of the warnings except for the background colour warnings which i can not see a way round.

Jayne
7th February 2006, 14:16
Glad you have sorted it now Taz, they can carry on not bickering now :lol:

Jayne

Mortime Business Software
7th February 2006, 14:22
Actually i have now sorted it and got rid of the warnings except for the background colour warnings which i can not see a way round.

Well done Taz. In my opinion, you are following good programming practices. My CSS sheet has a load of warnings at the moment, so I might soon be asking the same questions you did!

Dave

Coding Monkey
7th February 2006, 14:48
Why is that, Dave? He still has warnings. Just like the WC3 do on their site. They are just that - warnings. They're warning you that your font MAY not appear as you're using two of the same colours, or not using a colour. But, it WILL appear if override them, and the WC3 test does NOT verify this by looking at the CSS sheet. It would involve looking at your XHTML, and then, it still may be overridden by another external CSS sheet. But that test is not determining it.

If you want to get rid of every warning, feel free. Myself, David Horn (sorry, Dave, but your site has 'warnings' too), the WC3, Microsoft, Apple, Firefox (the 3 main browser companies) will continue to ignore them.

Tazuk
7th February 2006, 15:00
So what is the answer? Is this valid w3c css and can I display the w3c css logo?

And in the red corner!!

Jayne
7th February 2006, 15:02
I'll have 50p on Tom :lol:

Coding Monkey
7th February 2006, 15:03
Yes, it's valid.

Tazuk
7th February 2006, 15:08
Thanks for the advice, feedback and entertainment. If you guys ever need any help or advice about css or website be sure to come see me. LOL

Mortime Business Software
7th February 2006, 15:42
Why is that, Dave? He still has warnings. Just like the WC3 do on their site. They are just that - warnings. They're warning you that your font MAY not appear as you're using two of the same colours, or not using a colour. But, it WILL appear if override them, and the WC3 test does NOT verify this by looking at the CSS sheet. It would involve looking at your XHTML, and then, it still may be overridden by another external CSS sheet. But that test is not determining it.

If you want to get rid of every warning, feel free. Myself, David Horn (sorry, Dave, but your site has 'warnings' too), the WC3, Microsoft, Apple, Firefox (the 3 main browser companies) will continue to ignore them.

Calm down Tom. As I said, my CSS is very elementary and I'm just trying to learn a little bit here. You don't have to start stamping your feet just because someone disagrees with you.

Since Taz is a pilot, I'm sure he understands the need for strictness when dealing with machines, and even if those warnings were of no consequence, I would think that people like him regard warnings as a matter of principle. If his fuel gauge throws up a warning about low fuel, or that the fuel is being used at an unusual rate, there is no immediate error, but it is sure going to develop into a fatal error if he doesn't heed the warning!

And before you answer that, I realise that websites are different from helecopters, and are not going to jump out of the screen and stab someone to death if there is an error. I cite the scenario merely as an example that many people take warnings as warnings that something may happen if the problem the validator has with your work is not fixed.

By the way, if you look at the original list of warnings, there are a couple there that explicitly state that "This is not a robust style sheet". What are us CSS newbies to make of this? Do we simply ignore it and trust that nothing will go wrong? You may have the confidence and CSS experience to get away with this, but some of us don't.

You still havn't answered my question about why they bother to warn us about things which you say are going to make absolutely no difference anyway. What's the point? Why don't they just say something like "you've passed"?

Again don't take this the wrong way, but do you also ignore warnings from your programming ide debugging facilities?

Maybe the word "warning" has different implications within the two environments we are used to. If this is the case, then perhaps they should replace the word "warnings" with "information" or even "caveats" or something. Now those I can live with - well, sometimes! :)

I think Taz is following good programming practices. And I also said that Taz's CSS was valid, but should try to eliminate the warnings.

Dave

Tazuk
8th February 2006, 11:32
Ok just sorted out my CSS it now has no errors or warnings

Thanks agian for the feedback

TAZ