under the head session. Is there something wrong with the css? What's more weird is that i have 2 CSS. However my first stylesheet are able to retrieive the images but NOT ALL. And my second style sheet can't even retrieve the background img out. But all
those header, font size, color, margin are able to work correctly. Except for image retrieving.
Source looks OK but there are couple of items that caught my eye. One is that in one place you use id=navlist and another you use class=navlist; maybe we should check the css code as well. Be sure that after.css is in subfolder "StyleSheet".
are you sure images/header_bg.jpg path is correct? I'm not sure because I don't think you have Images folder and CSS file under the same folder.Go to one level upward, use .. like below.
I think you are facing file reference problem. Path of the css file or the image file is not correct. Best way to reference any file(css/js) is to use ResolveClientUrl like below-
While using masterpage we need to be careful about the file reference. Reson is masterpage does not have a real existance while it is rendered. Its ultimately the content page that rendered and all the css and js are resolved with respect to that content
page. For instance-
Suppose I have masterpage, contentpage and css like-
In this case the css will work only on contentpage1.aspx not on contentpage2.aspx. Reson is contentpage2.aspx will search for a css file which is cssfile.css in the folder somefolder, but its really outside the folder. So in this case the actual correct reference of the css file should be-
decdec
Member
33 Points
22 Posts
CSS couldn't be retrieve!!!
Nov 21, 2011 04:19 PM|LINK
hey guys, i am currently using VS 2010 ultimate. However i am not able to retrieve my css to the pages. Even though i have already put up this code
<link rel="stylesheet" type="text/css" href="styles.css" />
under the head session. Is there something wrong with the css? What's more weird is that i have 2 CSS. However my first stylesheet are able to retrieive the images but NOT ALL. And my second style sheet can't even retrieve the background img out. But all those header, font size, color, margin are able to work correctly. Except for image retrieving.
Can any one help?
THANKS ALOT!
cyoung311
Member
651 Points
210 Posts
Re: CSS couldn't be retrieve!!!
Nov 21, 2011 04:23 PM|LINK
Post your aspx source and let's have a look...
Nullum gratuitum prandium
decdec
Member
33 Points
22 Posts
Re: CSS couldn't be retrieve!!!
Nov 21, 2011 04:28 PM|LINK
<head runat="server"> <link href="StyleSheet/after.css" rel="stylesheet" type="text/css" /> <title></title> <asp:ContentPlaceHolder ID="HeadContent" runat="server"> </asp:ContentPlaceHolder> <%-- <style type="text/css"> .style1 { color: #FF3399; } .headbg { background-image: url("aImages/header_bg.jpg"/); background-repeat: repeat-x; height: 169px; } </style>--%> </head> <body> <div id="header"> <h1><span class="heading_color">Coo</span><span class="style1">l Racing</span></h1> </div> <div id="header_menu"> <ul class="navlist"> <li><a href="#">Log in</a></li> <li><a href="#">Sign up!</a></li> </ul> </div> <div id="container"> <div id="left"> <h4>Menu</h4> <div id="navcontainer"> <ul id="navlist"> <li id="active"><a href="#" id="current">Item one</a></li> <li><a href="#">Item two</a></li> <li><a href="#">Item three</a></li> <li><a href="#">Item four</a></li> <li><a href="#">Item five</a></li> </ul> </div> </div> <div id="right"><img src="#" alt="Ad1" width="48" height="48" class="thumbs" /><br /> <img src="#" alt="AD2" width="48" height="48" class="thumbs" /><br /> <img src="#" alt="Ad3" width="48" height="48" class="thumbs" /><br /> <img src="#" alt="car" width="48" height="48" class="thumbs" /><br /> <img src="#" alt="car" width="48" height="48" class="thumbs" /><br /> <img src="#" alt="car" width="48" height="48" class="thumbs" /><br /> </div> <div id="content"> <h2>About this template </h2> <p>testing </p> <h3>Get the original logo PSD </h3> <p><img src="images/cool_original_logo.jpg" alt="Cool Racing" width="208" height="141" class="images_left" />Get the Original header logo <a href="http://www.csstemplateheaven.com/index.php?main_page=product_info&products_id=17">here</a>. This will spice up your template pretty well, only seven dollars :) </p> <p>test </p> </div> <div id="footer"> </div> </div> </body> </html>cyoung311
Member
651 Points
210 Posts
Re: CSS couldn't be retrieve!!!
Nov 21, 2011 04:33 PM|LINK
Source looks OK but there are couple of items that caught my eye. One is that in one place you use id=navlist and another you use class=navlist; maybe we should check the css code as well. Be sure that after.css is in subfolder "StyleSheet".
Nullum gratuitum prandium
decdec
Member
33 Points
22 Posts
Re: CSS couldn't be retrieve!!!
Nov 21, 2011 04:34 PM|LINK
and i notice one weird thing, whenever i switch to design view, at the bottom left hand corner, it keeps showing the "requesting data"
decdec
Member
33 Points
22 Posts
Re: CSS couldn't be retrieve!!!
Nov 21, 2011 04:35 PM|LINK
* {margin: 0; padding: 0; } body { font-family:Arial, Helvetica, sans-serif; font-size: 62.5%; } #header { background-image: url(images/header_bg.jpg); background-repeat: repeat-x; height: 169px; } #header_menu{ background-image: url(images/header_menu.jpg); background-repeat: repeat-x; text-align: right; height: 73px; padding-top: 10px; } #container { font-size: 1.2em; } #left { float: left; width: 161px; margin-left: 20px!important; margin-left: 10px; padding-top: 27px; } #right { float: right; width: 210px; margin-right: 5px; padding-top: 27px; } #content { margin-right: 250px; margin-left: 210px; padding: 5px; }cyoung311
Member
651 Points
210 Posts
Re: CSS couldn't be retrieve!!!
Nov 21, 2011 05:18 PM|LINK
Content placeholder does not belong in the header section. I see nothing else wrong that would cause problems like you describe. I'll keep looking
Nullum gratuitum prandium
Ruchira
All-Star
44372 Points
7194 Posts
MVP
Re: CSS couldn't be retrieve!!!
Nov 22, 2011 04:52 AM|LINK
are you sure images/header_bg.jpg path is correct? I'm not sure because I don't think you have Images folder and CSS file under the same folder.Go to one level upward, use .. like below.
../images/header_bg.jpg
then try again
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.venkatanaras...
Member
172 Points
69 Posts
Re: CSS couldn't be retrieve!!!
Nov 22, 2011 08:05 AM|LINK
Hi
I think U miss Directory paths once u check all paths
Venkat Goud.
Mark as Answer if you feel so.
asteranup
All-Star
30184 Points
4906 Posts
Re: CSS couldn't be retrieve!!!
Nov 22, 2011 10:23 AM|LINK
Hi,
I think you are facing file reference problem. Path of the css file or the image file is not correct. Best way to reference any file(css/js) is to use ResolveClientUrl like below-
http://forums.asp.net/t/1712134.aspx/2/10?p%3DTrue%26t%3D634493200224408793
While using masterpage we need to be careful about the file reference. Reson is masterpage does not have a real existance while it is rendered. Its ultimately the content page that rendered and all the css and js are resolved with respect to that content page. For instance-
Suppose I have masterpage, contentpage and css like-
root/masterpage.master
root/cssfile.css
root/contentpage1.aspx
root/somefolder/contentpage2.aspx
Now if masterpage has a css reference like-
In this case the css will work only on contentpage1.aspx not on contentpage2.aspx. Reson is contentpage2.aspx will search for a css file which is cssfile.css in the folder somefolder, but its really outside the folder. So in this case the actual correct reference of the css file should be-
This kind of problem gets easily resolved with ResolveClientUrl.
Anup Das Gupta
Mark as Answer if you feel so. Visit My Blog