Jump to content

Recommended Posts

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;}

Link to comment
https://forums.phpfreaks.com/topic/217158-help-with-external-stylesheet/
Share on other sites

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.