External CSS stylesheets

Discussion about CSS related issues.
Envoid
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 2
Joined: Tue Aug 21, 2007 2:02 am

External CSS stylesheets

Post by Envoid » Tue Aug 21, 2007 12:40 pm

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

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3355
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Post by Albert Wiersch » Tue Aug 21, 2007 1:05 pm

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.
Image
Albert Wiersch

Envoid
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 2
Joined: Tue Aug 21, 2007 2:02 am

Post by Envoid » Wed Aug 22, 2007 3:15 am

Albert,

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

Chris

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

paulp575
Rank III - Intermediate
Rank III - Intermediate
Posts: 52
Joined: Tue Aug 09, 2005 1:20 pm
Location: Spokane WA
Contact:

Re:

Post by paulp575 » Wed Dec 31, 2014 12:55 am

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

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3355
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: Re:

Post by Albert Wiersch » Wed Dec 31, 2014 7:37 am

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.
Image
Albert Wiersch

paulp575
Rank III - Intermediate
Rank III - Intermediate
Posts: 52
Joined: Tue Aug 09, 2005 1:20 pm
Location: Spokane WA
Contact:

Re: External CSS stylesheets

Post by paulp575 » Wed Dec 31, 2014 11:07 am

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

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3355
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: External CSS stylesheets

Post by Albert Wiersch » Wed Dec 31, 2014 11:29 am

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.
Image
Albert Wiersch

paulp575
Rank III - Intermediate
Rank III - Intermediate
Posts: 52
Joined: Tue Aug 09, 2005 1:20 pm
Location: Spokane WA
Contact:

Re: External CSS stylesheets

Post by paulp575 » Wed Dec 31, 2014 1:23 pm

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

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3355
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: External CSS stylesheets

Post by Albert Wiersch » Wed Dec 31, 2014 2:26 pm

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.
Image
Albert Wiersch

paulp575
Rank III - Intermediate
Rank III - Intermediate
Posts: 52
Joined: Tue Aug 09, 2005 1:20 pm
Location: Spokane WA
Contact:

Re: External CSS stylesheets

Post by paulp575 » Wed Dec 31, 2014 2:50 pm

Awesome!
paulp575

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3355
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: External CSS stylesheets

Post by Albert Wiersch » Thu Jan 01, 2015 1:16 pm

How about this? :)

Image
Image
Albert Wiersch

paulp575
Rank III - Intermediate
Rank III - Intermediate
Posts: 52
Joined: Tue Aug 09, 2005 1:20 pm
Location: Spokane WA
Contact:

Re: External CSS stylesheets

Post by paulp575 » Thu Jan 01, 2015 2:30 pm

To be consistent, how about a zero following the word "Styles" in the Styles tab?
paulp575

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3355
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: External CSS stylesheets

Post by Albert Wiersch » Thu Jan 01, 2015 4:03 pm

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.
Image
Albert Wiersch

Davpar
Rank 0 - Newcomer
Rank 0 - Newcomer
Posts: 5
Joined: Sat Nov 07, 2015 5:29 am

Re: External CSS stylesheets

Post by Davpar » 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?

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3355
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: External CSS stylesheets

Post by Albert Wiersch » Tue Jul 17, 2018 10:37 am

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
Image
Albert Wiersch

Post Reply