Jump to content

Linking stylesheets


ejaboneta

Recommended Posts

I've been using php to include my css files. I decided to instead link them but when i do, the results aren't the same. Some things aren't working. For example, when i link it, if a tables width or height is set to 100%, it won't work. I even tried putting the height in the actual table but its not working there either. Some of the background colors aren't working as well. Is there a way to fix this or am I going to have to just include it like I have been?

Link to comment
Share on other sites

There are a number of problems. I'll touch on a couple:

 

1) You don't need <style> tags in the external sheet. They invalidate your code.

2) You have the <style> tags before your doctype on the page where it's internal. The style tags have to be between the <head> tags of your document, or they invalidate your code. In this particular case, because they are before your doctype, your doctype is being invalidated. The doctype has to be the absolute first thing in your HTML. It cannot have spaces, tabs, newlines, or any kind of text before it, or it is invalidated. This is most likely causing your problem, because without a doctype, the browser has no way of knowing what rules it should use to parse the HTML. And when you have any output before the doctype, it's the same as not having a doctype.

Link to comment
Share on other sites

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.