all. I'm using conditional commenting in IE to fix some CSS problem that i'm having with IE7.
I have a all.css file that work on firefox and ie7 with some execptions that will only fix the IE7 css problem. I put my fix on all_iefixes.css both files is in App_Themes/Default/ folder.
I use have a master page (Default.master) that all my pages inherited. On some page that is inside another folder, for example, localhost/myapp/blah1/blah.aspx will not get the all_iefixes.css in the App_Themes/Default folder If i change the
<!--[if IE]><style type="text/css">#import "all_iefixes.css";</style><![endif]-->
to
<!--[if IE]><style type="text/css">#import "./../App_Themes/Default/all_iefixes.css";</style><![endif]-->
then it will work for the page inside the blah1 folder but it will break other page that doesn't live inside blah1 folder.
I think i can create several master page and depend on where i want to put my aspx pages to live then i can adjust the link but i think this is a rather "stupid" fix (?). Is there an elegant way to do this.
Jack
You should avoid using relative paths in your master pages unless you can generate it with code:
You can try using server tags to resolve the path, but this is not always possible (for instance, if youre manipulating the control tree in code)
#import "<% this.ResolveUrl("~/App_Themes/Default/all_iefixes.css") %>";
+1 from the ablove. However, I'd rather use browser files in ASP.NET.
Related
Something is wrong. When I open my site using localhost then everything is fine. What can be wrong here?
And when I click assets/css/style.css I got error like this:
When ew check Network tab, and click on style.css sotmething weird happens because html file is previewed:
As myself and Quentin mentioned in the comments, it is generally good practice (and the intended effect for most situations) to use /assets/path/to/resource instead of the relative path assets/path/to/resource.
Unless it is intended to leave out that slash (which it isn't in your case, as you said in the comments), you'll need to prefix all the asset links with slashes.
<link rel="stylesheet" href="/assets/css/style.css">
<link rel="stylesheet" href="/assets/css/scregal.css">
etc.
There is only one possible causes of the problem I know although your question is not so clear.
1.》 Make sure the assets folder is in the same location as your html file.
》Prefix all your href link with a dot. Check the image to see
I faced a problem like this when I wanted to push one of my electron apps to production mode. The dot makes it easy for the packager to load the whole folder.
I'm new to ASP, ASP not ASP.NET. I've programmed before, had experience in PHP. I have many experience with HTML and CSS. I like to organise my files. I know (in php file) I only have to link the external css in the tags to style my webpages. I assume it's the same for ASP. It does, but not for me.
Whenever I tried to edit the style of my asp program and run it in the server it doesn't work. I created other pages as well and same thing happened. Whenever I used Google Chrome to see the elements, I could see my code, but when I click on the style sheet in the 'INSPECT ELEMENT' tool, it opens at the side with nothing there. I did script the css, and tried to make the background color black. The styling works only when I do an internal styling within the asp file between the tags.
Does anyone know how I may solve this issue? I hate using internal css as external ones are faster and more organised.
Check the following common issues:
Make sure your stylesheet file has a file extension of .css
Check if you have a MimeType setup for .css files as text/css in your IIS.
If you're returning CSS code from a .asp page file extension, make sure you first call Response.ContentType = "text/css" at the top of the page.
When including it in your html document make sure you're using something along the lines of the following syntax:
.
<link rel="stylesheet" type="text/css" href="mystylesheet.css">
I've got <link rel="icon" type="image/png" href="myimage.png" />, why doesn't it work? It gives me the blank/new document icon in the favicon.
Does it have to be an icon.
Does it have to be from a URL?
It worked previously but it's stopped now, I might have changed something, but I don't think so, I didn't update anything, add any gadgets or anything, it just stopped working.
I have tried a few things such as using URL or an .ico instead of PNG, and I've looked online too, but I can't figure it out. It could be because I'm hosting the site file in a google drive sync but I doubt it somehow.
Thanks. In case anybody needed it, I've got the code on paste bin: http://pastebin.com/Wzc9zLea << HTML and CSS
You need to meet the specifications => PNG/GIF/ICO, 8- or 24-bit colors, and size 16x16 or 32x32, which your image doesn't meet at all. By the way, why do you wrap your code with <a> tags?
P.S. - You might want to remove 'shortcut.'
To answer your questions, whether it has to be an icon–I think you mean whether it has to be a .ico or a .png file, and that depends on the browser. As a general rule, most of the time it can be a png, no problem. For much more detail, check out this SO answer.
As for whether it has to be "from a URL", that's tough to give a yes/no answer to because it's a bad question. If you mean, does it have to be from an external URL accessed via the HTTP protocol, then no, it doesn't. It can be a file path and that works just fine. Anything that requires a URL will generally take a file path no problem.
Side notes:
As I mentioned in my comment, there's no need to wrap your code in <a> tags, and it may be screwing with your code.
Some people are saying you don't have a closing <head> tag, but I see it just fine, so not sure what that's all about.
Your favicon should be saved as a .ico filetype. Place the NAME.ico in the root of wherever your website is. You can go to this site http://www.favicon.cc/ and have your .png made into a favicon. Then just put it into the root and you're set.
It varies depending on the browser and these days the device (tablet, smartphone, etc). But at a minimum, your favicon link should be constructed as follows:
<link rel="icon"
type="image/png"
href="http://example.com/myicon.png">
Currently, your file reference is relative to URI, meaning that if you have pages deeper than one level below your document root, your code is going to break. To illustrate, here's an example:
If you visit http://example.com, the browser will look for your favicon file at http://example.com/myicon.png.
If you visit http://example.com/mycategory/myarticle.html, the browser will look for your favicon file at http://example.com/mycategory/myicon.png, which won't be found.
See the problem? So either use an absolute path to your favicon file:
<link rel="icon"
type="image/png"
href="http://example.com/myicon.png">
or make the path relative to your document root:
<link rel="icon"
type="image/png"
href="/myicon.png">
Looking at the HTML you posted, another obvious problem that stands out is poorly structured (invalid) HTML. Remove the first four lines in your HTML document:
1. HTML
2. <a>
3. <!DOCTYPE html>
4.
The first line is just text and will confuse browsers trying to determine the document type of the page being loaded. The second line is a valid HTML element but it needs to exist within parent
<html>
<body>
...
</body>
</html>
elements. The third line isn't a valid declaration and looks like a stab in the dark, and the fourth is a blank line. If you don't actually know what HTML standard you're coding to, it's probably best to simply omit the DOCTYPE declaration and simply let the browser guess the standard to use because this WILL affect how your HTML is interpreted (and rendered). I don't know if it's universally true, but I think most browsers will fall back to the loosest HTML standard in the absence of a defined DOCTYPE.
One final thought. If you're new to HTML and/or don't have any sort of formal education/training, take some time to go through online tutorials. http://www.w3schools.com is a basic resource that can help you better understand the language.
I have created a very small personal website with three different pages and one CSS file. I know to embed a CSS file into an html page is the following:
<link rel="stylesheet" type="text/css" href="mystyle.css"/>
but form some reason the CSS file only work in one page. Any advice please
Did you checked your folders structure? You may have other html file in different folders.
I suggest to use an absolute path for your stylesheet. something like:
<link rel="stylesheet" type="text/css" href="/css/mystyle.css"/>
first / in href parameter is what I mean.
Edit: You may use a windows machine and upload your files into a Linux machine. Windows do not care about lowercase or uppercase, but it is important on Linux. rename all your filenames to lowercase every where and use it exactly the same in your code (check your link tags again). this may fix your problem
Sharing the link of the site would be helpful. Make sure that the line of CSS aboves goes on each page. For example, if you have 3 pages with 3 different files: index.htm, bio.htm and contact.htm (I'm having to guess since I have not gotten this info from you). Then make sure the link to the CSS above appears on each of those pages.
So I just finished working on a site on my computer, and I put it on a flash drive and put it in my public_html folder on my server. When I type in http://localhost/ I get my index page but the css is gone and all the images are gone.
How can I fix this?
Sorry, this question is from years ago. For those interested, the problem was due to permissions on my server.
Ensure that you have put the right path for your css and images.
Make sure that inside your html, the path to your css is correct.
link rel="stylesheet" type="text/css" href="mystyle.css"
Your href="mystyle.css" should have a correct reference by using ..(dot-dot) just like "../folderName" in case your css file is one or more directory away from you main folder.
Sometimes all that you need to do is clear your browsers cache, which will store the pages current state and will sometimes ignore any new changes to the css and sometimes even images until the cache is cleared.