phprocker Posted October 28, 2010 Share Posted October 28, 2010 Hey all. I have some CSS styling in my page headers that works only when included on the page itself and not linked from a file. Can anyone see what I'm doing wrong? index.php <head> <link rel="stylesheet" type="text/css" href="styles/default.css" /> </head> //code that doesn't load the external style <table class="background1" width="1000px" height="420px" cellspacing="10" cellpadding="15"></table> styles/default.css .background1 {background-image:url(images/meh.gif);} .background2 {background-image:url(images/back.png);} img {border-style:none;} Quote Link to comment https://forums.phpfreaks.com/topic/217158-help-with-external-stylesheet/ Share on other sites More sharing options...
michaellunsford Posted November 1, 2010 Share Posted November 1, 2010 Rather than relative links, you should try to put absolute links in code to ensure all the files are found. This generally can be achieved by simply putting a slash before your directory structure. I would do this for both the html file calling the CSS and in the CSS file calling for images - like so: <head> <link rel="stylesheet" type="text/css" href="/styles/default.css" /> </head> //code that doesn't load the external style <table class="background1" width="1000px" height="420px" cellspacing="10" cellpadding="15"></table> .background1 {background-image:url(/images/meh.gif);} .background2 {background-image:url(/images/back.png);} img {border-style:none;} Also, why are you putting style information in your <table> tag instead of the stylesheet? Quote Link to comment https://forums.phpfreaks.com/topic/217158-help-with-external-stylesheet/#findComment-1128968 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.