Jump to content

Transferring Internal Style Sheet CSS to External Style Sheet

Bigcat1943's Photo
Posted Feb 15 2010 09:01 AM
1851 Views

I created a web page using CSS to style it. I purchased CSS The Missing Manual and worked through the tutorials and everything worked fine. I used the arrows on buttons that is described in Ch. 9 tutorial, page 258-269.

While I have the CSS in the internal style sheet everything works like it should. When I copy the CSS and place it in the external style sheet everything works fine except the arrow does not appear on my buttons.

The CSS in the internal style sheet is the last CSS read. I tried placing the CSS in various places in the external style sheet, including last, but the arrows do not appear. Don't know why it can't find the image from the external style sheet but it can from the internal style sheet.

I have done other CSS internally and copied it to external sheets without problem. I can not figure out what the problem is with the arrow not showing up when it is in the external style sheet. The catch is, I have 10 pages that the buttons will be used on. I don't want to have to create/edit this 10 times if changes are made later.

What am I doing wrong?

Howard

Tags:
2 Subscribe


2 Replies

 : Feb 16 2010 01:43 PM
I don't have the book, and no css was posted, so this is just a shot in the dark, but if the CSS specifies other content (images), could the path to the content be different? External content defined in an external CSS is relative to the CSS file's location, not the original document's location.

That is, an html page /test.html with an external CSS file at /css/back.css with this statement:

body {background-image:url('back.jpg');}

Is looking for the file /css/back.jpg, NOT the file /back.jpg.
0
  todisht's Photo
Posted Feb 18 2010 07:24 PM

The pathing problem mentioned by KBenson is most likely your issue. Make sure that the image paths in your external CSS file are correct. They will need to be relative to the location of the CSS file not the to the individual page.