Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 9 of 9
  1. #1
    Member
    Join Date
    Jan 2004
    Posts
    68
    Member #
    4547
    I'm in the process of learning CSS, and am just creating basic pages and trying to get them to do what ever I feel like at the time. In this particular case I've added a background image and color, along with a container and header/footer divisions. In IE the style displays correctly, but in Firefox it's as if I don't have a stylesheet. Any idea why?

    Any help is greatly appreciated,

    Jake

  2.  

  3. #2
    Senior Member audiofreak9's Avatar
    Join Date
    Apr 2005
    Location
    NJ
    Posts
    339
    Member #
    9584
    Welcome to WDF. A link or your code could help figure your problem out.

  4. #3
    Member
    Join Date
    Jan 2004
    Posts
    68
    Member #
    4547
    It's not online, I'm just practicing with it, trying to learn design without tables, I guess the right way, right?

    I attached the HTML file and the stylesheet.

    I am using Crimson Editor, if that has any bearing on the conversation.

    Jake

  5. #4
    Senior Member glyakk's Avatar
    Join Date
    Nov 2003
    Location
    USA
    Posts
    1,263
    Member #
    3828
    Liked
    6 times
    The problem seems to be that you are trying to call your css file as if you were locating a file on your computer

    <link rel="stylesheet" type="text/css" href="C:\Documents and Settings\Administrator...

    Im assuming the css file is in the same directory as the html file correct? if so you can simply put the name of the css file in your 'href' attribute..

    <link rel="stylesheet" type="text/css" href="stylesheet.css...


  6. #5
    Member
    Join Date
    Jan 2004
    Posts
    68
    Member #
    4547
    Thank you very much it fixed the issue, but raised another question. It doesn't seem to be good practice to have the stylesheet file in another directory, but if it happened to be in a different directory would that have worked, or does the stylesheet have to be in the same directory always. Does the fact that my files are local have any effect on this? Again thanks for the help.

    Jake

  7. #6
    Senior Member glyakk's Avatar
    Join Date
    Nov 2003
    Location
    USA
    Posts
    1,263
    Member #
    3828
    Liked
    6 times
    Choosing to put the files in another directory actually is considered good practice, but is not nessessary.

    But if you choose to have your style sheet(s) in another directory you have two ways that you can use to write the paths in order to 'point' to the css( or any other) file. Absolute, or relative.

    For example, imagin your files are on your webserver. When you go to your site(www.yoursite.com) you are viewing the index file(index.htm). In the same directory as your index file you have another directory called styles that you use to store all your css files including stylesheet.css. From your index file you can point to this file two different ways..

    <link rel="stylesheet" type="text/css" href="/styles/stylesheet.css...

    or

    <link rel="stylesheet" type="text/css" href="styles/stylesheet.css...

    They are almost identicle, but if you look, you will notice one has a forward slash and the other does not. The one that does is the absolute method. You will also notice that you do not have to signify to the browser witch method you are using, it will just figgure it out. Paths that use the absolute method always start at the root of your web directory(this is signified by the leading forward slash), and work down though your directory(s) to your destination(stylesheet.css). It wouldn't matter where your index file was located on your webserver, as long as stylesheet.css remained in that location you could always point to it using this exact path.

    Relative paths are different in that it points to another location based on where your index file is. In our example the stylesheet.css file was in the style directory that was located on the same level as the index file so the path starts with the directory name than works its way down to stylesheet.css.

    But what if you had another index file was in a directory called pages that was on the same level as your style directory? You already know that with absolute paths you would still use the same path that you used on the first index file. But how would you point to the stylesheet.css file using a relative path? You would have to go up one level, than work back down to the stylesheet.css file. It would look like this..

    <link rel="stylesheet" type="text/css" href="../style/stylesheet.css...

    The ../ tells you to go back one level, than you go into the style directory, than to stylesheet.css.

    I know this might sound confusing, but I hope this makes sence.


  8. #7
    Member
    Join Date
    Jan 2004
    Posts
    68
    Member #
    4547
    Yea that makes sense, thanks alot for the explanation. I have one more question, with the help from you I got the styles to work, mostly, but the background image still isn't showing up. I got the colors and layout to show up, but no background image. Any idea why?

    Thanks again,

    Jake

  9. #8
    Senior Member glyakk's Avatar
    Join Date
    Nov 2003
    Location
    USA
    Posts
    1,263
    Member #
    3828
    Liked
    6 times
    Same reason as to why your style sheet was not working.. you have the path to your background image pointing to a file on your computer..

    body {background: url('C:\Documents and Settings\Administrator\My Documents\Web Design\Doctor Page\bgimage.jpg')}

    These files are not set up to look for files that way. You have to think like these files are on a webserver by using a relative or absolute path. This will work as long as the background.jpg is in the same directory as your stylesheet that is calling it..

    body {background: url('bgimage.jpg')}


  10. #9
    Member
    Join Date
    Jan 2004
    Posts
    68
    Member #
    4547
    Thank you, its displaying properly now.

    Jake


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:57 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com