📜 ⬆️ ⬇️

Problem with css in firefox with doctype specified

Today, I spent half an hour on an unusual problem for me: The document in all browsers is displayed normally, but for some reason, the styles did not work in the firefox.

The problem arose only after placing the site on a shared hosting - everything worked fine from the home test server.
The css file was kind of available, however, firefox did not define it as a style.

In fact, everything turned out to be quite simple: when the document DOCTYPE is registered, the firefox becomes demanding on the type of the contents of the file with the style sheet, that is, the server must return the file exclusively with Content-Type: text / css, in accordance with the W3C specification . However, the host’s Apache was configured in some interesting way, so that it returned css files with Content-Type: text / plain.
')
Because of this absurdity, I had to lose a lot of time.

When I had already dealt with the problem, I found that it was already discussed on the Mozilla forum in 2007 , I was just looking for an answer not for those key words.

Source: https://habr.com/ru/post/55556/


All Articles