I prepared my bootstrap website using visual studio and it works properly.
But when I try to run html file through going in that folder then bootstrap css is not loading.
Can you tell me the reason behind this?
Thanks in advance
Here is my head section
<link href="../font-awesome-4.2.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="../dist/css/bootstrap.min.css" rel="stylesheet" />
<link href="../dist/css/bootstrap-theme.css" rel="stylesheet" />
<title > K.P Facility Management</title>
<link href="StyleSheet.css" rel="stylesheet" />
<link rel="shortcut icon" type="image/png" href="../images/title.png" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../dist/js/bootstrap.min.js"></script>
Most probably the paths are wrong. With the "../" before your path, you're going up a level from the root, which will return an error (if you look at the inspector).
Try placing this html in the folder that contains the folders you are going to use files from, and change the paths to:
<link href="dist/css/bootstrap.min.css" rel="stylesheet" />
<link href="dist/css/bootstrap-theme.css" rel="stylesheet" />
Related
After building my web site for a while now, I wanted to see if I could upload it to my domain and see if it was functional from the web.
Now I have this error coming from my css files :
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://www.benny-water.com/Mainscss2.css"
I have been googling for 3 hours straight and haven't found a solution. If I understand it is my server (OVH) that is wrongly interpreting the css files as html or text files but I have no idea where to change this.
my code for the css files looks like this :
<head>
<title> Benny Water </title>
<link rel="stylesheet" type="text/css" href="Mainscss2.css"> </link>
<link rel="stylesheet" type="text/css" href="/style/Css3.css" />
<link rel="stylesheet" type="text/css" href="style/Grid.css" />
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Oxygen"/>
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Muli"/>
<link rel="stylesheet" type="text/css" ng-href="js/Jportfolio/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" ng-href="js/Jportfolio/css/jportilio.css" />
<link rel="stylesheet" type="text/css" ng-href="js/Jportfolio/css/jportilio_style_default.css" />
<script type="text/javascript" src="js/Jportfolio/js/jquery-1.11.2.min.js"/>
<script type="text/javascript" src="js/Jportfolio/js/bootstrap.min.js"/>
<script type="text/javascript" src="js/Jportfolio/js/jportilio.js"/>
<script src="http://code.jquery.com/jquery-latest.min.js"/>
</head>
thank you for your help :)
Looking at your paths there seems to be a mismatch between where your CSS files are located.
<link rel="stylesheet" type="text/css" href="Mainscss2.css"> </link>
<link rel="stylesheet" type="text/css" href="/style/Css3.css" />
<link rel="stylesheet" type="text/css" href="style/Grid.css" />
The /style/Css3.css has a / in front of your path, but the style/Grid.css doesn't.
Your Mainscss2.css link is also closed incorrectly. I would removed </link> and close the tag with /> instead for consistency in your code.
The .css file must go inside the <head> tag, while the .js in the <body> tag. It is a rule but it obviously work anyway also when they all are inside <head> too.
About the path of your .css, are you sure it is correct?
<link rel="stylesheet" type="text/css" href="Mainscss2.css"> </link>
<link rel="stylesheet" type="text/css" href="/style/Css3.css" />
<link rel="stylesheet" type="text/css" href="style/Grid.css" />
there are 3 different paths for 3 .css
Use this scheme:
/var/www/mywebsite/index.php
/var/www/mywebsite/images/favicon.ico
/var/www/mywebsite/style/css/mytheme.css
/var/www/mywebsite/style/css/images/imagesUsedBymytheme.png
/var/www/mywebsite/style/js/myscript.js
of course modify it accordingly, if you are index.php, you would want to link your .css using this code:
<link rel="stylesheet" href="style/css/mytheme.css" type="text/css" >
EDIT:
<link> is a single tag, you can use it as <link rel="" href"" >
I have a JSP page which contains CSS links as follows. This is the complete code in the JSP(a.jsp):
<link href="/aspenet/resources/css/StyleSheet.css" rel="stylesheet" type="text/css" />
<link href="/aspenet/resources/css/default.css" rel="stylesheet" type="text/css" />
I include a.jsp inside b.jsp as follows:
<head>
<title>Title</title>
<link rel="stylesheet" type="text/css" media="screen" href="resources/css/jquery/ui-lightness/jquery-ui-1.8.6.custom.css" />
<jsp:include page="a.jsp"/>
<script type="text/javascript" src="resources/js/jquery/jquery-1.7.2.min.js"> </script>
<script type="text/javascript">
</head>
But the styles of the default.css does not reflect in b.jsp when I run the application. Help me to resolve the issue.
Try to use following code in your a.jsp page.
<link href="<%=request.getContextPath()%>/css/StyleSheet.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/default.css" rel="stylesheet" type="text/css" />
request.getContextPath()- return root path of your application so let say your application name is demo then it will try to find demo/css/xyz.css file.
Hope it may help you.!!
My github pages site #americano-project.github.io is transferring css files as plaintext, not text/css, causing my browser(firefox 25.0.1) not to load the css.
The css is embedded as so:
<link rel="stylesheet" type="text/css" src="/css/tmp.css" />
<link rel="stylesheet" type="text/css" src="/css/toast.css" />
The code is at a github repo, what is causing the problem?
It should be href, not src (Chrome 33 also did not parse them for me until I changed the src to href).
<link rel="stylesheet" type="text/css" href="/css/tmp.css" />
<link rel="stylesheet" type="text/css" href="/css/toast.css" />
Trying to build a webpage. and relative css link wont work. Only direct linking.
Head:
<link href="http://directorym.net/App_Themes/customDarkBlueWAdSense_en-US/customDarkBlueWAdSense_en-US.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="http://pboo.mobi/corey/articles_media/dmNet.css" />
<link rel="stylesheet" type="text/css" href="http://pboo.mobi/corey/App_Themes/mobile.css" />
test at http://pboo.mobi/corey
when i make it relative:
<link rel="stylesheet" type="text/css" href="articles_media/dmNet.css" />
<link rel="stylesheet" type="text/css" href="App_Themes/mobile.css" />
it wont show up.
Suggestions?
Use the absolute path:
<link rel="stylesheet" type="text/css" href="/corey/articles_media/dmNet.css" />
<link rel="stylesheet" type="text/css" href="/corey/App_Themes/mobile.css" />
Looking at your site and changing page code on the fly with browser, they show up with both relative and absolute paths.
Anyway remember that relative means "relative to the current page path".
You have three options when it comes to url paths:
a) Absolute
href="http://www.mysite.com/myfolder/myfile.css"
b) Relative
href="myfile.css"
c) Absolute with forward slash instead of domain name
href="/myfolder/myfile.css"
suppose the folders articles_media and App_Themesand the html page are all based in the same original folder. The header of the html page can then contain:
<link rel="stylesheet" type="text/css" href="/articles_media/dmNet.css" />
<link rel="stylesheet" type="text/css" href="/App_Themes/mobile.css" />
(note the / before the folder name)
To add to what people have said so far, also consider using the full path but using protocol relative links.
<link rel="stylesheet" type="text/css" href="//pboo.mobi/corey/articles_media/dmNet.css" />
<link rel="stylesheet" type="text/css" href="//pboo.mobi/corey/App_Themes/mobile.css" />
This way you won't have to worry about potential security errors with http:// or https://
i have this structure in my project
I have this page 27.html, so i have to find the CSS file, so i think the correct path was :
<link href="../../../css/style.css" rel="stylesheet" type="text/css" />
<link href="../../../css/inner.css" rel="stylesheet" type="text/css" />
But it's not working, so i wonder why this happens..
Any idea ?
UDPATE:
Hi guys, this is my URL:
/web/blog/2011/june/27.html
I'm trying
<link href="/css/style.css" rel="stylesheet" type="text/css" />
But still not applying the css in the page.
Best regards,
Valter Henrique.
Why not just use the root as a reference?
<link href="/css/style.css" rel="stylesheet" type="text/css">
You need to specify your path from the root URL to make this easier, with the '/' at the front.
<link href="/css/style.css" rel="stylesheet" type="text/css" />
You only need two ../.
Try this:
<link href="../../css/style.css" rel="stylesheet" type="text/css" />
<link href="../../css/inner.css" rel="stylesheet" type="text/css" />
You could always just do this to get to your web root:
<link href="/css/style.css">
Rather than fiddling with relative paths, go absolute.
Your paths look OK, are you sure the CSS files were uploaded to your server and that the file names are actually correct?
In doubt with ".." navigation, move your files closer and do some trials and error until you get it.