This trouble affects all loaded resources (internal links, img, css, js). I'm tried use this code for load css:
<link rel="stylesheet" href="/css/jquery.mobile.min.css" />
But he work only if I connected to server via browser. When I connect via PhoneGap app on phone, resources not loading.
After it, I tried this code:
<link rel="stylesheet" href="./css/jquery.mobile.min.css" />
And the same result..
How to solve this problem?
if your css file is in the www\css folder then use:
<link rel="stylesheet" type="text/css" href="css/index.css" />
this is how I got mine to work
You need to add the In App Browser Plugin.
plugin name="cordova-plugin-inappbrowser" spec="1.0.1" source="pgb"
Then run...
window.open("http://www.sitename.com", '_system');
Make sure that the css folder is inside the www folder and then remove the first slash /, like this:
<link rel="stylesheet" type="text/css" href="css/jquery.mobile.min.css" />
Related
I have a static website that is locally stored in the C drive: C:\site
I've now created a new site within IIS and pointed it to that location.
When I type 'localhost' in the browser, it pulls up the sites index.html
The issue is I've lost all CSS / JS / etc. and I assume this is because my paths aren't pointing to the right source. I have the same issue for links (hrefs).
Before connecting to IIS, my paths were as follows:
<link rel="stylesheet" type="text/css" href="C:/Site/css/MyFontsWebfontsKit.css" />
<link rel="stylesheet" type="text/css" href="C:/Site/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="C:/Site/css/style.css" />
<script type="text/javascript" src="C:/Site/scripts/jquery-1.12.3.min.js" ></script>
<script type="text/javascript" src="C:/Site/scripts/bootstrap.min.js" ></script>
I've tried looking around for answers, as well as trying some things such as:
<link rel="stylesheet" type="text/css" href="localhost/Site/css/style.css" />
OR:
<link rel="stylesheet" type="text/css" href="http://localhost/Site/css/style.css" />
But still no luck in seeing my CSS, JS, etc.
As for the links, they were working before IIS and looked like this:
About Us
I assume once I can achieve the correct paths for my CSS & JS I'll be able to figure out the links. Any help would be appreciated. Thanks!
If your folder structure is this:
css
style.css
index.html
Then the path css/style.css will always work from index.html, regardless of where it's hosted. You're hard-coding root paths in the references, so when the root path changes in any way it's going to break all the references.
Try:
<link rel="stylesheet" type="text/css" href="css/style.css" />
(With the same change applied to other references.)
You can always reference files relative to each other, but referencing them relative to the root requires a consistent root.
I'm working on a portfolio and it looks great in localhost, but when I try to commit it to Github (https://gabrielbrickle.github.io/) the CSS does't work.
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="css/nivo-lightbox.css" rel="stylesheet" />
<link href="css/nivo-lightbox-theme/default/default.css" rel="stylesheet" type="text/css" />
<link href="css/animations.css" rel="stylesheet" />
<link href="css/style.css" rel="stylesheet">
<link href="color/default.css" rel="stylesheet">
<link href="css/custom.css" rel="stylesheet">
try changing this:
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
to this:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
If you open the developer console(right click inspect element), It says youre trying to load from http in a https
Use https:// for bootstrap css Link.If you right click , Inspect and look at the Console in Chrome you'd find the errors.
Github is loaded over HTTPS. Referencing external stylesheets will require the same protocol.
You can see the errors in DevTools.
You can either save Bootstrap locally and reference it, or load it with HyperText Transfer Protocol Secure (HTTPS).
I had a similar issue. I messed around and figured out that I had referred to one of the sources incorrectly. I used the wrong case for the first letter of a folder of a source. I had used ./Assets/css (incorrect one) instead of ./assets/css (correct one). Fixing the error fixed the CSS on the Github site as well!
I'm working on a project using arduino, node.js and socket.io. I am running it in localhost, however my external stylesheet wont load.
The error seems to be saying it cant get my css from this path http://localhost:1337/css/main.css
However if i keep the css in a style tag in the html file it all works fine, is there a way to keep the css external so it doesnt clutter my html file?
Heres how im loading in my css
<link rel="stylesheet" type="text/css" href="css/main.css">
Here is how my file structure looks
Here is my main.css file inside the css folder
my main.css file is within the css folder, i am working off of the interface.html file
Try this instead:
<link rel="stylesheet" type="text/css" href="./css/main.css">
notice the ./ in front of the href
otherwise include full path name:
<link rel="stylesheet" type="text/css" href="http://localhost:1337/css/main.css">
this is what i have tried and it is working for me
<link href="./main.css" rel="stylesheet" type="text/css" />
thanks
To serve static files such as images, CSS files, and JavaScript files, use the express.static built-in middleware function in Express.
The function signature is:
app.use(express.static(__dirname));
Then you can include like bellow
<html>
<link rel="stylesheet" href="/css/style.css">
</html>
The relative path kicks off from your html path so
<link rel="stylesheet" type="text/css" href="main.css">
should work (as your main.css is outside of the css folder). Alternatively, you could put the main.css file on the css folder and reference it with "css/main.css"
I was facing same problem as you are facing but i tired below code and it works.
body{
background-color: yellow;
}
h1{
color: red;
}
p{
color:green;
}
<html>
<head>
<link href="./external.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>This is my First page to test CSS</h1>
<p>The main motive to making this html file is to test my CSS skill.....</p>
</body>
</html>
Thanks,
hope it will help you......
I'm also facing this problem... But I found a solution and its working. Try the below code line:-
<link rel="stylesheet" type="text/css" href="css/main.css?v=<?php echo time(); ?>" />
For anyone else that's having this problem, I was having the same problem and found a solution. My localhost was apparently following a path to a cached CSS stylesheet file, even though it had been overwritten countless times.
Solution: Rather than opening the stylesheet directly from the folder to edit, I had to manually open it from my text editor dropdown menu. After hours of frustration, it was that simple. I use Sublime Text, if it makes any difference, but it seems to be a problem with the localhost, and I suspect clearing the cache would have had the same result.
I was handed a site to update at my job that utilizes one template file. I have made changes to both the template file and the index file as well as several CSS files. What happens when I launch the website live is that the sites contents appear without any styling/functionality. I believe I have linked to all the correct styling links in my head sections because in Dreamweaver the sites render perfectly fine in both Firefox and IE. I'm in a jam at my job. Any help is appreciated! Thanks
UPDATE: I selected the option from Dreamweaver's Modify menu: "Apply template to page" which corrected some of the CSS reference issues. The page renders perfectly now in IE 9 but still no styling whatsoever in Firefox. Any ideas from anyone? I'm completely stuck now. Thanks for all the answers so far!
Open Firefox developer tools, check the Network tab for any 404s, particularly on .css files. If there are any, that means it can't access the file.
The permissions on a directory could be wrong, the webserver (nginx/apache) might not be able to access it, or you may have linked it incorrectly (is your website in a subfolder or at the root of the domain? do your links need leading slashes?).
The path to the CSS files are incorrect, set them correctly (Absolute or Relative)
<link href="file://///hqdaa0n02731-06/wtc$/css/bs_paper/bootstrap.min.css" rel="stylesheet" type="text/css" media="screen, min-device-width, resolution" />
<link href="file://///hqdaa0n02731-06/wtc$/js/plugins/css/bootstrap-accessibility_1.0.3.css" rel="stylesheet" type="text/css" />
<link href="file://///hqdaa0n02731-06/wtc$/css/print.css" rel="stylesheet" type="text/css" media="print" />
<link href="file://///hqdaa0n02731-06/wtc$/css/wtc_home_3box_pic_option.css" rel="stylesheet" type="text/css" />
<link href="file://///hqdaa0n02731-06/wtc$/css/yamm_2014.css" rel="stylesheet" type="text/css" />
Should be like this:
ABSOLUTE
<link href="http://www.wtc.army.mil/css/yamm_2014.css" rel="stylesheet" type="text/css" />
RELATIVE
<link href="/css/yamm_2014.css" rel="stylesheet" type="text/css" />
On my web page I have the following line in the <head> element:
<link type="text/css" href="C:/myApps/app1/images/css/12.02/main.css" rel="stylesheet" />
When I go to view that page in Firefox 11.0, it is obvious that the main.css is not being loaded. If I go to view page source, I see the <link> element (above) in the HTML, but when I click it I get the following error:
Firefox doesn't know how to open this address, because the protocol (c) isn't associated with any program.
How do I fix this?
try:
<link type="text/css" href="file:///C:/myApps/app1/images/css/12.02/main.css" rel="stylesheet" />
might work
Edit: as per the other answers, this is when you want to use a css file on your local machine, if the website will be hosted then you'll need to use a relative path.
<link type="text/css" href="images/css/12.02/main.css" rel="stylesheet" />
The above assumes that your html file with the link in is located in your "app1" folder.
Martyn
you need to insert an url/uri => file:///C:/myApps/app1/images/css/12.02/main.css
Hi you cas change your css path
<link type="text/css" href="C:/myApps/app1/images/css/12.02/main.css" rel="stylesheet" />
into
xxx.css replace into correct path
<link type="text/css" href="xxx.css" rel="stylesheet" />