Style Sheet not recognising new lines...
I came across a weird problem the other day. Sorted it myself but the forum users may be interested...
I like to hand write my own style sheets. One page I was writing needed a larger font size so I added a new line at the top of the *.css external sheet. it came up as the default size Times Roman and no matter what I tried it absolutely would not take (Century Gothic 72pt). No other styles were affected. What was weird is that if I doubled up the offending line in the style sheet, suddenly the correct font and size appeared.
What had happened is that I had accidentally pasted a short piece of code from another page at the top of the sheet (nothing to do with styles) and this must have been corrupting the scanning of the codes. What was strange also is that was in a line of notation which should have been ignored - also a tasteful shade of pale grey so not so easy to spot.
Seems like corrupt codes like this only affect the next line underneath and not the whole style sheet
I wonder whether perhaps it's to do with the final character of the corrupt code - perhaps not a standard line ending, causing the next line to be treated by browsers as part of the corrupt code.
It's easy to overlook something you're not looking for.
This is a site I built for my work.(RSD)
This is a site I built for use in my job.(HTML Editor)
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
My theory is that the page is remembering an older version of the style sheet and using that instead of updating to the new one on load. If that is the case adding this line of code under your <head> tag before deleting your history may help as well.
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com
Simply using Developer tools to disable cache will work during development but if your workflow is based on putting stuff online frequently you will eventually face a situation where you are not anymore in control which version of your CSS code your visitors see (and you can't count on them using their Developer tools to disable caching).
In order to prevent stuff like this from happening you should use a technique called "cache busting" which essentially means you will be appending stuff to your resource URLs that will change every time your resource files change. Essentially your CSS URL transform from this
<link rel="stylesheet" href="style/css_2-play.css" type="text/css"/>
to something like this
https://www.youtube.com/channel/UCL8qVv … ttneYaMSJA
Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.