CSS not working in stylesheet
This is just a shot in the dark as (at the time of this post) you haven't provided source code.
Make sure you're linking to your stylesheet using a link
tag in the head
of the HTML document.
If you had:
<style type="text/css">
/* <![CDATA[ */
#someid
{
margin: 0;
padding: 3px 12px;
}
/* ]]> */
</style>
You'll need to have
#someid
{
margin: 0;
padding: 3px 12px;
}
in your CSS file with:
<link rel="stylesheet" type="text/css" href="path/to/style.css" />
to link to the stylesheet.
Some common newbie mistakes include:
<style type="text/css" src="path/to/style.css">
: because it's a similar syntax to the<script>
tag, which would make sense, but is invalid<link rel="stylesheet" src="path/to/style.css">
: butlink
elements use href not src- placing
link
elements within the body: although browsers will tend to managelink
elements in the body, there are likely going to be some errors, and it's not a defined behavior - not specifying a doctype declaration: allows the browser to go into quirks mode, which is never a good idea.
CSS External Style Sheet isn't working, but the exact same CSS was woking on an internal Style Sheet
So, I've found the problem. It turned out I encoded it in UTF-8 Bom( I'm not sure that's the name of the enconding type) and that was causing problems with the browsers and the external style sheet, witch wasn't enconded in the same format. I'm going to mark this awnser had having solved my problem.
The solution is enconding the HTML source file in UTP-8, or other files that are supported and enconding the HTML and CSS source files in the same format.
Thank you for anwsering, tough.
CSS stylesheet not loading
Check the file name,sometimes when you rename via PC it tends to add layout.css.txt change the file name to just .css
.
Move the file to the root where you have you HTML don't create any sub-folders for time being.
Please mention if your trying to upload to a server or just practicing,so we can give you precise instructions.
Complete list of reasons why a css file might not be working
Are you sure the stylesheet is loaded? You can see it using the "Net" tab of Firebug on firefox, or on "Network" tab of the Console of your browser.
(If 1 works) can you have a simple sample style and see whether this is getting applied (and visible in the console)?
Some CSS styles in css file are not applied, but they work when added to header of Html page
Seems like your CSS file is cached. In Django static files get cached by default so try opening the page in incognito mode or try doing hard refresh(shift + f5 in chrome, ctrl + f5 in firefox).
External CSS Stylesheet not loading
Try rel="stylesheet"
instead of rel="css"
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
And if your file path is correct then it must load css, simple as that
Related Topics
Why Doesn't This CSS Transition Work on Svg Inside an Anchor
How to Make a Link Inside a Div Fill the Entire Space Inside the Div
Hide All Elements Except One Div for Print View
-Ms-Filter VS Filter What's the Difference
Cssrules/Rules Are Null in Chrome
Phpstorm: How to Setup Less to Output to CSS Directory with File Watcher
Concatenate String and Var Less CSS
Generate Solid Colors Using CSS Linear-Gradient (Not Smooth Colors)
Why Does SASS Prepend an Incorrect @Charset Rule
Google Chrome, Flash and Z-Index Wrong Behaviour
Use Variable Defined in Config.Rb in SCSS Files
How to Add a Company Logo to Shinydashboard Header (Not Mainpanel or Mainheader)
Make Input Value Uppercase in CSS Without Affecting the Placeholder
Font-Weight Is Not Working Properly
How to Set Keyframes Name in Less