CSS styles are not being applied - html

I am working on a small web project which was working perfectly fine for some time but suddenly some CSS styles are not being applied anymore.
I have applied styles through a class in HTML.
When I write the same styles inline they are working fine but when applied through a class in HTML, they aren't working.
My question is, why are they working inline but not when I put them in a class and attach a CSS file?

If they are working inline but not when the file is linked I would guess that the link to the css file might have a typo. I had a similar problem earlier and turns out I was linking index.css instead of styles/index.css since I had put the css into its own folder.

First of all check the path of your css file wherever you linked it.
If its not a typo then simply press Ctrl+F5 in chrome (Windows).
Many times when your css file is large so your browser stores it in cache and hence not every time it renders your css file when updated in editor and reloaded the site.
To rectify this simply press Ctrl+F5.
This will clear the browser cache for that tab(that website) and reload the page forcing the browser to render the updated css.
EDIT: For Mac if you are using safari, the shortcut is Command+Alt+E
In Mac if you are using Chrome, Ctrl+F5 will not work, so refer to this site: https://clear-my-cache.com/en/apple-mac-os/google-chrome.html

Related

Why is #shadow-root in my document and why is it overriding my CSS

First, I've seen the duplicates
What is #shadow-root, and why does it put display none on my font awesome classes?
and
HTML / CSS - DIV Element hidden when it shouldn't be?
however both of these suggest the issue is with adblock and I have totally disabled adblock.
I am more concerned with where the #shadow-root is coming from, since I certainly did not put it there.
I have read that there is an option in chrome to disable it (and interestingly enough I have it disabled...), but this means that anyone using my website will need to do the same, and I'd rather just do away with it entirely as it provides zero usefulness in my application.
I have also googled and read many of articles about the shadow dom and none of them give any insight on why it would appear seemingly for no reason.
From what I have seen in inspector/view page source, the entire contents of my app are being rendered into this shadow dom and thereby not receiving any of my styles.
I am using rails, react, redux, react-redux, react-router
Chrome developer tool screen
Page Source screen
Notice that the source has nothing in the div that react should be rendering to.
Additional info:
displays unstyled page on chrome in normal and incognito
does not work at all in safari
A lot of chrome plugins automatically create this shadow root in your inspector. For example, ever since I downloaded Vimium, I've had a shadowroot div at the bottom of any page I've opened in chrome. It's nothing to worry about.
I was having the same issue and found that it was Adblock Plus that was adding #shadow-root. Thanks to the resources above I was able to assertain what the issue
For me it was also an Adblocker (uBlock) and it was actually hiding part of the webpage I was making which showed imported tweets. Turning the adblocker off for my site fixed it.

Why does the link tag sometimes not work while style tag works?

I was playing with Path 2.0 flying menu (http://codepen.io/sparanoid/pen/nHAmi) earlier and realized once I remove the link style tag from the index.html and put them into css files to link back to the file, the web page doesn't work as it was before anymore.
The link tag I use is very standard:
<link rel="stylesheet" href="css/style.css" type="text/css"/>
This link tag replaces the second style tags in the example files. I searched online and there is no documentations about some condition when only the style tag could work.
I suspect that the reason might be prefixfree.js cannot interpret css files (but can interpret style tags). I wonder if that's the reason, how I can set up correct interpreter for prefixfree.js.
Try not to use prefixFree. It's a buggy plugin. It doesn't always work with webkit based browser such as Safari, Chrome, or Opera even when set up a remove server (and certainly do not work when using local files).
There are two reasons why this might break:
Browser can't download the file.
The order of style sheets matter.
Look into your browser's error log. If you see an error there, fix it.
If there is no error, then there is a problem with the order of the styles. Later styles overwrite earlier ones. Try to move the <link> element to see how that changes things or use your browser's developer tools to see which styles get applied.

Form css changes in different browsers

I have a form in the website http://helloiwant.com/demo.html
It is done with bootstrap. However when I view it on either safari or firefox, it doesn't show it properly but it always shows it properly on chrome. My guess is something to do with css but I cannot figure out the solution. Thanks in advance!
I looked at the source code of the webpage, if everything being white is the problem you have to change color and border-color in the css to black(#000) (or the color you want) since everything is white/(#fff).
But it seems like you are using an external source for the bootstrap css, so you should go to the official site and download bootstrap and put it on your server. Remember to customize it to fit the style you are going for, or edit it manually after downloading it.
Or you can create an extra css file that loads after the boostrap css, and just add overrides for the colors.
I have no idea why it works for you in Chrome, in my experience Chrome always finds a way to load outdated css files, try to disable cache in the developer tools.
How to disable cache in chrome? <-Check answer here

Fonts gets loaded after mouseover html tag

When page of my application is loaded font in some html tags is default one and when you mouse over it, proper font immediately shows. I made a list of things that probably matters:
Position of element doesn't matter, it occurs on absolute and static.
Font of my choice if assigned to body tag so there is no way some stylesheets don't get loaded.
I load fonts via #import from fast.fonts.net. This line of code is almost on the top of my stylesheets, above is only reset.
I load my assets from s3, minified in one file.
It never occurs locally and the only browser that this bug was seen is Chrome.
It is rare bug, maybe 1% of all page refresh, so reproducing when you want to see it is difficult
Once I have seen this issue in bugsnag.com
App is heavy on front-end side
Do you have any ideas how I could fix it?
I discovered that injecting fonts via JS script tag and not css #import works best. After that client stopped reporting me this issue.
It's simple change and the reason why it works must be connected with some Chrome bug.

Firefox Can't See the CSS/HTM Link in Aptana

Why won't Firefox see the link between the HTML and the CSS when I try to view in Aptana? I've emptied the cache in Firefox, checked that the files are in the same folder, double and triple checked the code structure and placement in the header on the html page and tried Safari as the preview browser. I'm working from the local drive. Firefox and Safari see and read the html page fine, but none of the CSS style attributes are "cascading".
Sounds frustrating but there's always a solution (I guess),
First of all, is the link to the css file correct?
Second, is the link inside the header? Placing the file in the body could influence the result.
Thrid, load the page in firefox, right click on the page and select view page source. Locate the link to your css file and check the absolute path from there (click it and see if your css file is actually there).
Maybe the syntax is wrong, try using href="./style.css" in the stylesheet link.
Hope this helps