Page 1 of 2

External CSS stylesheets

Posted: Tue Aug 21, 2007 12:40 pm
by Envoid
Should CSE (v8 Standard) automatically validate external stylesheets?

I have a page with the usual link tag, e.g.
<link href="css/main.css" rel="stylesheet" media="all" type="text/css" />

I know there are errors in it but CSE reports nothing. I do get warnings in the Styles tab for some inline styles that library code generates.

If I select the stylesheet in the Links tab and use 'Open Link in Editor' I can then F6 and find the errors.

I had hoped CSE would do this automatically. I think I have all the correct settings (e.g. 'Enable CSS style checking' in the 'Style (CSS)' options tab).

Thanks in advance,
Chris

Posted: Tue Aug 21, 2007 1:05 pm
by Albert Wiersch
Hi Chris,

You will have to open external CSS files separately to check them for errors. However, if you're crawling a site using the Batch Wizard, then it will in most cases also check the CSS file.

When working with a document in the editor, CSE HTML Validator does not automatically go into other documents. This keeps things simpler and lets you work only on the document you have opened.

Posted: Wed Aug 22, 2007 3:15 am
by Envoid
Albert,

Many thanks, now I know how it is supposed to work.

Chris

P.S. Good product by the way :-)

Re:

Posted: Wed Dec 31, 2014 12:55 am
by paulp575
Albert Wiersch wrote:Hi Chris,

You will have to open external CSS files separately to check them for errors. However, if you're crawling a site using the Batch Wizard, then it will in most cases also check the CSS file.

When working with a document in the editor, CSE HTML Validator does not automatically go into other documents. This keeps things simpler and lets you work only on the document you have opened.
So are you saying there could be style errors in your HTML document, i.e., you've used a CSS style that's not in the external CSS stylesheet file and HTML Validator won't flag that error?

Re: Re:

Posted: Wed Dec 31, 2014 7:37 am
by Albert Wiersch
paulp575 wrote:So are you saying there could be style errors in your HTML document, i.e., you've used a CSS style that's not in the external CSS stylesheet file and HTML Validator won't flag that error?
Hi Paul,

CSE HTML Validator finds a lot of issues but if you are asking if it will find a problem when you use a CSS class that doesn't exist then the answer is no. That is one type of issue that CSE HTML Validator cannot currently detect. However, you can write a custom user function to only allow the valid CSS classes and to generate an error if a class is used and not recognized. This might get rather involved.

Re: External CSS stylesheets

Posted: Wed Dec 31, 2014 11:07 am
by paulp575
Sorry, I'm still confused.

I have the validator engine options set to check CSS. However, when I check a file, the styles tab is blank; nothing there.

So what CSS does the validator check?

I was hoping it could validate a file and determine there is an external style sheet and check the styles you used against the styles listed in the external stylesheet, but I guess that gets too complicated?

Re: External CSS stylesheets

Posted: Wed Dec 31, 2014 11:29 am
by Albert Wiersch
paulp575 wrote:I have the validator engine options set to check CSS. However, when I check a file, the styles tab is blank; nothing there.
Hello,

If the Styles tab is empty then no CSS problems were detected. This could also mean CSS checking is turned off.
paulp575 wrote:So what CSS does the validator check?
It checks CSS syntax, which means it mostly checks the CSS properties and their values, among some other syntax tests. It can also pick up links in CSS for link checking.
paulp575 wrote:I was hoping it could validate a file and determine there is an external style sheet and check the styles you used against the styles listed in the external stylesheet, but I guess that gets too complicated?
Yes, that gets complicated. It doesn't check to make sure the classes you use are defined somewhere. Also, sometimes classes that don't exist (aren't defined) in the CSS styles may be purposely used for other reasons, like for use with JavaScript. This creates another complication.

I hope this helps to clarify what CSE HTML Validator checks and what it doesn't. Please let me know if you have any more questions.

Re: External CSS stylesheets

Posted: Wed Dec 31, 2014 1:23 pm
by paulp575
No more questions - thanks for the interaction.
I wonder if somewhere (maybe in the Styles tab or in the Main tab?) there should be something to explain when you have it checking and nothing appears in the styles tab? Just a thought.

Thanks,

Re: External CSS stylesheets

Posted: Wed Dec 31, 2014 2:26 pm
by Albert Wiersch
paulp575 wrote:No more questions - thanks for the interaction.
I wonder if somewhere (maybe in the Styles tab or in the Main tab?) there should be something to explain when you have it checking and nothing appears in the styles tab? Just a thought.

Thanks,
Thanks for the suggestion. In a future update I'll see if I can add a message in the "Styles" tab to indicate that there are no style messages so it's not completely blank when there are no style messages. This should be clearer and less confusing.

Re: External CSS stylesheets

Posted: Wed Dec 31, 2014 2:50 pm
by paulp575
Awesome!

Re: External CSS stylesheets

Posted: Thu Jan 01, 2015 1:16 pm
by Albert Wiersch
How about this? :)

Image

Re: External CSS stylesheets

Posted: Thu Jan 01, 2015 2:30 pm
by paulp575
To be consistent, how about a zero following the word "Styles" in the Styles tab?

Re: External CSS stylesheets

Posted: Thu Jan 01, 2015 4:03 pm
by Albert Wiersch
paulp575 wrote:To be consistent, how about a zero following the word "Styles" in the Styles tab?
I thought of that... but then to be consistent most of the other tabs would need it too, and that would make the length of all the tabs even longer than it is now. I'm not sure it would be an overall benefit.

Re: External CSS stylesheets

Posted: Tue Jul 17, 2018 10:21 am
by Davpar
I’ve just accidentally solved a CSS problem that had been bugging me both yesterday and this morning – but I don’t know how! Can anyone explain the following? I prepared an HTML web page with all the formatting contained in the <style> section of the <head>. When I had got it just the way I wanted I cut it out of the HTML and pasted it in to an external CSS style sheet, correctly linking to it with the appropriate <link href=> command, a job I’ve done hundreds of times before. Strangely, the web page didn’t render properly, mainly in the <header> area. I tried pasting and re-pasting bits of the code from the CSS into the <head>and back again, several times, always finding a mismatch between how it rendered with the CSS link and with it overridden by the same code in the <head>. After lunch I went back to it and eventually, mysteriously, got them to agree. Anyone any idea what sort of thing could have caused this?

Re: External CSS stylesheets

Posted: Tue Jul 17, 2018 10:37 am
by Albert Wiersch
Davpar wrote: Tue Jul 17, 2018 10:21 am I’ve just accidentally solved a CSS problem that had been bugging me both yesterday and this morning – but I don’t know how! Can anyone explain the following? I prepared an HTML web page with all the formatting contained in the <style> section of the <head>. When I had got it just the way I wanted I cut it out of the HTML and pasted it in to an external CSS style sheet, correctly linking to it with the appropriate <link href=> command, a job I’ve done hundreds of times before. Strangely, the web page didn’t render properly, mainly in the <header> area. I tried pasting and re-pasting bits of the code from the CSS into the <head>and back again, several times, always finding a mismatch between how it rendered with the CSS link and with it overridden by the same code in the <head>. After lunch I went back to it and eventually, mysteriously, got them to agree. Anyone any idea what sort of thing could have caused this?
If it mysteriously started working, then my thought would be that it was some kind of cache issue. Did you do a Ctrl+F5 (and not just F5) to force a refresh of everything (assuming you are using Chrome or other browser where that works)?

More info on "force refreshes" and bypassing your cache:
https://en.wikipedia.org/wiki/Wikipedia ... your_cache