Why does browser not render some CSS it's loaded? - html

My CSS file is being loaded by the browser. I can see it in the list of network resources in developer tools, and if I visit the CSS file directly, I can see the file. It appears to have the correct type (stylesheet).
But, despite everything being downloaded correctly, the browser doesn't render the content according to the rules in this CSS file.
I have no idea what's causing this.
My link from the head section:
<link rel="stylesheet" href="/static/css/components.css">
It's being served by nginx.
Thanks!

Did you double-check you have the right selectors? Maybe typos?
Did you double-check you're not overriding something? Maybe with inline styles?
Did you double-check the CSS properties you are using are supported by the browser on which you do the test?
Those are the 3 things that I can think of for now. You can try to be more specific for a better answer.

Carried on looking. Although developer console reported the type as 'stylesheet', the mime-type was coming as text/plain. I've fixed my server configuration and now get the CSS rendered.
Thanks for the suggestions.

Related

Browser not showing css sources from minified css in developer tools

I have added a minifed css to my website for better speed and performance. However, When i look into the browsers developer tools, the css sources for any elements are coming from nomal theme.css file, instead of theme.min.css.
I dont know wheather my minified css files is being used or not? Anyone please guide.
Also, I have theme.min.css.map file. When its being used?
If you see the minified CSS file path in your tags, it's being used. If Chrome developer tools show the original file in italic, it's being referenced by the map. Like this:
Image taken from: Why does Chrome devtools show these folders in orange and in italics?
Did you give the correct file name? it should be theme.min.css instead of theme.css
Double confirm you have given the right file name ,you might have not or
It might be that the content are loaded from cache clear your cache or try with hard refresh pressing Ctrl+f5 if you are in Mozilla firefox browser.

Do browsers request favicon.ico even if it is not linked in the HTML

I am looking for a site for somebody, and fixing errors as I find them.
There is no Favicon.. that is ok, I can fix that.
My question is, do browsers (or certain browsers, Chrome in this case) request favicon.ico as soon as they load a site.. or maybe on check that there is no alternative icon path mentioned in the source.. irrespective of whether "favicon.ico" is actually mentioned in the page source?
That was the original behaviour, yes. /favicon.ico was an implicitly present file which (some) browsers would check for. Only later did that actually morph into a proper standard with <meta> tags, arbitrary file names and image formats other than .ico.

CSS DROPDOWN MENU not working from WEBsite but OK on developer machine [duplicate]

I downloaded the barebone example of Twitter's bootstrap and customized it. I tested it locally (with WAMP server) and everything works perfectly, both the CSS and the JScript.
I uploaded the files to my webhosting service and the JScript just doesn't work. I noticed it because dropdown boxes stopped working.
I searched and found other persons with the same problem but they all are using ruby and I'm not. Just the play CSS+JScript provided by bootstrap. Besides they said the solution was to include the bootstrap.js first and then the jquery.js. Well I tried it and it didn't work, I even included the not minified .js and still it didn't work.
I'm using the same browser (Chrome) for local and remote testing. I also tried different hosting services and the problem occurred in both.
Help is much appreciated.
Other similar questions:
Javascript features work on localhost but not when deployed to Heroku
twitter bootstrap drop down suddenly not working
The issue might be that you load boostrap.js before jQuery. Locally your browser may be using a cached copy of Jquery, so it works there but not on your live site. Try fixing it by switching those two lines in your code:
<script src="/code4pt/styles/js/bootstrap.js"></script>
<script src="/code4pt/styles/js/jquery.js"></script>
I know this is very strange but I think I got the solution. Previously I was using the (supplied) jQuery 1.7.2 minified. Now I changed it to use the jQuery 1.8.0 not minified. It just started to work... Another thing I did was to convert all files' encoding to UTF8 (I think this was the real problem/solution)
I had the same problem. In IE, the site was working on localhost but not when hosted on a different server. Adding the following meta tag fixed it.
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
I had the exact same problem, so was relieved to find this post and others like it. My resolution was similar. I pulled my hair out for half a day trying all different things. Walked the dog. Had half a dozen beers. Slept on it. Had breakfast. Recopied back the stylesheets at top, and the js from the bottom from the local html to the server php, and then for some unknown reason it started working again. The only points which seem useful for others going through the same:
Try and get back to a working scenario - in my case the index.html was working on the server but not the index.php. Getting these the exact same was key.
Try on different browsers just in case something strange is going on.
Make sure you keep clearing the browser cache (e.g. right click on the reload button in Chrome and choose 'Empty Cache and Hard Reload')
Inspect your bootstrap css and js versions. Change them forward and backward in version until you get success. Chances are, the version that came with your bootstrap theme download is the most likely one to work.
I was having simular issues before. The tabs function was working fine in my HTML site, but would not work when coded into a Wordpress theme. All of the source URLS were being generated dynamically with Wordpress's .
The tabs finally began working when I added all JS links (except for Modernizr into the footer instead of the header.
Back to basics: If Debug is set to true on the local machine and false on the deployment environment as it should be, make sure your .min.js files are not overriding customizations you have made to the non-minified versions of .js files (applies to .css as well).
You can also turn Debug off on the local machine and you should see the same issues.
Late to the party but I found out that my issue was that the Bootstrap.js was not being pushed out during deployment.
In addition to the very useful suggestions by #dialex and #Darrell , I will add that if none of that works, you can review any code that you might be linking to, ie. via require ('page.php');, for duplicates. Duplicated .js links tend to cause these issues.
I ran into this on a site I built and uploaded to Amazon S3. Worked fine on my local machine and even my local server, but didn't work when served from Amazon. The console in Firefox (but not Chrome) showed it was failing to load bootstrap.min.css (et. al) because their MIME type was not text/css.
I had to use the S3 console to force change their types to text/css, clear caches, and reload. Voila!
I'm using Codeigniter. I solve these issues by changing my base_url in config.php.
Previous :
$config['base_url'] = 'http://localhost/public_html';
Changes to :
$config['base_url'] = 'http://(my intranet server ip adress)/public_html';
Had the same problem
In my .html files I had this line
<link th:rel="stylesheet" th:href="#{/webjars/bootstrap/4.0.0-2/css/bootstrap.min.css} "/>
After changing it to this
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
Everything works fine. I guess that internally webjars have http and changing css link to start with https solved my problem

Twitter Bootstrap favicon.ico

I am working on a site using the one of the twitter bootstrap templates and my JavaScript console is complaining that it is missing:
favicon.ico
ie-emulation-modes-warning.js
I downloaded all of the Bootstrap files from the Bootstrap website. What are these files and do I need them?
If so, where can I get them?
Edit: Thanks guys! Looked into Favicons and didn't realize that is what they are! So simple! lol
By default, browsers look for favicons in your site's root directory. You can use favicon generators online, which (by standard) create 16x16 pixel png-like objects that are used as your site's icon on a browser tab, etc. Just make one of those and drop it in your root directory.
If that doesn't work, you may want to use your inspector (assuming you're using chrome), right click > inspect element > console (or network), and look there to see where your template is looking for the favicon. Just drop the generated .ico file in that folder.
For the JS file, you may be able to find it online, download it, use the inspector again, and drop it wherever your browser is looking for it. This is good for performance—missing files slow roundtrip requests down.
It's something browsers look for by default. Nothing to do with Bootstrap
http://en.wikipedia.org/wiki/Favicon

Another Firefox relative path conundrum

Ok.
So I know this is probably a stupid question, but I've been traversing SO and Google for the last many hours for an answer and found nothing.
I'm currently creating a HTML5 mobile app using JQM 1.2.0 and Google Maps js V3 - just to set the context.
My problem occurs when I try to test the page in FF 18 desktop version. In every other browser, be it mobile or desktop, I'm not having any problems. Also, I have tried on both localhost as well as the server I'm deploying to, and it's the same result.
In my HTML file I have a relative link to css and js files:
<script src="js/general.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/mobile.css"/>
while my links to JQM etc. are absolute as I use a CDN:
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
When I use Firebug, I can see that the files with a absolute path are loaded fine, while the relative path links are ignored - or at least I think so, as nothing shows up in neither the Console or the Net pane.
When I check the Html pane in Firebug, it appears as if it has included a tag pr default (with the correct URL), but not if I try to view page source using the regular FF methods. Even though, I have tried to include a explicit base tag to my header and it changes nothing.
So, to sum up: relative path works fine in all browsers except FF, it it happens on both my server and localhost.
Update:
Tried moving the files to the root dir, but it didn't help.
Also, when trying to view the content of the js or css file in Firebug (pressing the arrow to the left of the tag in index.html), it just says:
Reload the page to get source for: http://localhost/~u040800/app/general.js
which, of course does not change after reload.
Nevermind - stupid mistake on my side!!
Note to self: when developing, do make sure that your add-ons are disabled before asking SO! otherwise, you make a complete ass of yourself!!
Yes, it is correct - I forgot to disable Ad-Blocker...
#robertc: Sorry to have wasted your time.