CSS Style Sheet not working when opening file in browser - css

Style sheet affects my pages that are online, but not when I open it in a browser. My style sheet is called myStyle.css but when I link it to a different page by using
<link rel="stylesheet" type="text/css" href="/myStyle.css">
And it didn't work. It does work when I upload it to godaddy, but not when I just open it in a browser.

Related

Stylesheet doesn't gets applied on website after bundle (MVC)

The issue is CSS Does not effect on website after bundle although all of bundle process is fine
From the view source code page i can see the css file but it does not take any effect on website. The code bellow is what i used to call css and saw from view source code page and from my layout file.
<link rel="stylesheet" type="text/css" src="/Content/css?v2">
Does anyone have any idea for this?
Thank you.
You used
External Style Sheet
With an external style sheet, you can change the look of an entire website by changing just one file!
Each page must include a reference to the external style sheet file inside the <link> element. The <link> element goes inside the <head> section:
your code
<link rel="stylesheet" type="text/css" src="/Content/css?v2">
try like ths
src should change to href
<head>
<link rel="stylesheet" type="text/css" href="/path/yourcssfilename.css">
</head>

FireFox showing css files in Style Editor but not in Network Monitor

I have CSS files that are being loaded correctly in FireFox (52.0.1). They are listed in the Style Editor tab, but not in the Network Monitor tab. It doesn't matter if I click All or CSS in the Network Monitor tab, no CSS files show up.
I am including the css files in the <head> like so:
<link rel="stylesheet" type="text/css" href="https://{path}/css/print.css" media="print">
<link rel="stylesheet" type="text/css" href="https://{path}/plugins/components/jquery-ui/themes/base/all.css" media="all">
I'm assuming they're supposed to show up in the Network Monitor tab considering there is a CSS option, so what gives?
As your screenshot says that there were only 15 requests but you obviously have 8 files in the Network Monitor and an even larger number of CSS files, this looks like a bug in the Firefox DevTools.
I suggest you first try out a new Firefox profile. If it works there, its obviously a bug in your profile. You may track it further down to a specific preference or add-on causing the CSS files not to be listed within the Network Monitor, but in any case you should file a bug.

External Style Sheet partly not working

I made an external style sheet, uploaded it to godaddy, and gave my main page the link
<link rel="stylesheet" type="text/css" href="myStyle.css">
and it worked, but not on Firefox (it did work on all other browsers I tried). Then I tried to link my other pages to the style sheet and it did not work for them (copied and pasted the link tag above, but when that didn't work I tried doing
<link rel="stylesheet" type="text/css" href="/public_html/myStyle.css">
which is the full file directory to the style sheet, and that didn't work either. Note: When I just opened the other pages on a browser, (without uploading to godaddy) the external style sheet worked in all of my pages.
This is the first time I'm trying this, so might be making an obvious mistake. Thanks in advance.

CSS not styling page but is loaded in DOM

Hello there ladies and gentlemen.
I've got quite the puzzler going on. I have just installed a fresh instance of Laravel (5.1) on a Vagrant (1.7.4) machine in Windows (10). The weird thing is that I'm linking both the external stylesheet and javascript the same way:
<link href="{{ URL::asset('css/app.css') }}" rel="stylesheets" type="text/css">
<script src="{!! URL::asset('js/all.js') !!}" type="text/javascript"></script>
The problem is that the styles are not being applied (cross-browser) to the elements. I'm not getting any errors in the console. When I look at the head of the document I can see that it's the right path:
<link href="http://laravel.dev/css/app.css" rel="stylesheets" type="text/css">
<script src="http://laravel.dev/js/all.js" type="text/javascript"></script>
I have a standard Laravel file structure with the CSS and JS folders inside the public folder. If I look at the sources tab inside Chrome developer tools, I can see that the JavaScript file is being loaded but there is no sign of the CSS file. But if I right-click on the link for the CSS file, and open link in new tab, I can see the CSS. I have tried explicitly changing the character encoding type to UTF-8 both as an attribute in the link tag as well as the first line of the css itself with the #charset 'at rule'. Here are some illustrations:
Thanks for your help.
In your css-link you have rel="stylesheets" (plural). It should be rel="stylesheet" (singular) :)

Bootstrap glyphicons without changing fonts

I am using Bootstraps glyphicons, including them like this:
<!-- Load Bootstrap CSS (Flatly) and Javascript -->
<link rel="stylesheet" href="http://bootswatch.com/flatly/bootstrap.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">
Before I loaded the glyphicons CSS file my fonts were fine. I did not set the font, instead using whatever Bootstrap or jQuery sets the font by default.
Now I have included that glyphicon CSS file, my fonts have changed. Can I utilize the glyphicons whilst ignoring the fonts?
As you can see here http://www.bootply.com/5Amv5odg7X you don't need to load the glyphicons separately, just be sure to load stock Bootstrap before flatly, and you're good to go.
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://bootswatch.com/flatly/bootstrap.min.css">
Also, it's usually considered best practice load your .js files after all html content, so it doesn't impact page load.
You are using a custom version of Bootstrap css that already includes the icons and imports a custom Google font. Check the file you're linking to here:
<link rel="stylesheet" href="http://bootswatch.com/flatly/bootstrap.min.css">
This file contains all of the styles for the glyphicons embedded in it, so no need to separately add the link to the cdn for <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">.
As for you fonts "changing", the first line in this file imports the Lato font from Google and sets as the body font. If you don't want to use the custom font, download the flatly css file (instead of linking to the remote file) and remove the import statement at the top of the css file. Or, override the styles in your own css file. (Better to do the former, as it would be a waste to have your site visitors download the Google fonts, if you're not using them).

Resources