www.webdeveloper.com
Results 1 to 9 of 9

Thread: Style sheet not recognized by some browsers

  1. #1
    Join Date
    Feb 2008
    Location
    NW Washington State
    Posts
    1,856

    Style sheet not recognized by some browsers

    I've put together a simple 3 page site for a friend so he can practice and learn html and css. It's really just a mismatch of old content so he can see what divs, paragraphs, lists, floats, etc are and how to edit them. It used 1 external style sheet with a dozen or so styles that he can edit and play with. He's using Chrome to view and NotePad++ to do the edits.
    When I created the pages I tested in IE, FF, Safari, and Chrome on my machine and everything displays as expected. After doing a few edits on his machine, testing in Chrome, things display as expected. However, when he uploaded the site to his server, only IE would use the style sheet.
    http://home.wavecable.com/~j72mac/index.html
    I don't understand why that should happen! So I uploaded the site to my server and all 4 browsers display using the style sheet.
    http://www.cidigitalmedia.com/tutori...oot/index.html
    Any idea what the difference in servers could be? Are style sheets handled differently by some servers than other?
    Best wishes,
    Eye for Video
    www.cidigitalmedia.com

  2. #2
    Join Date
    Mar 2006
    Posts
    172
    If I had to guess, I'd guess that it has something to do with your style sheet href address having spaces in it. You could try renaming the folders without using spaces in the name (use underscores _ ) and then adjusting the href value of the style sheet link.

  3. #3
    Join Date
    Dec 2005
    Posts
    2,984
    Wow....that's weird.

    I checked with firebug, though, and it appears that his server is serving the .css file as text/html while yours is serving it as text/css.

    It's a server issue, obviously.

    If he's allowed to use a .htaccess file (I doubt it if his server is screwed up that badly to serve css and html) then you could try adding this to the .htaccess file:

    Code:
    AddType text/css .css

  4. #4
    Join Date
    Aug 2006
    Posts
    1,942
    On his server, the doctype for this page is HTML Loose, with a bunch of stray "/>" terminating elements, and on your server the doctype is XHTML. I have no idea whether or why that might be the problem, but it is curious...

    Dave

  5. #5
    Join Date
    Feb 2008
    Location
    NW Washington State
    Posts
    1,856
    The file name uses underscores
    Code:
    style_sheets/main_styles.css
    But thanks for taking a look!
    it appears that his server is serving the .css file as text/html while yours is serving it as text/css.
    How can you tell that?
    The use of the server is a freebee given to customers by the cable company so I'm not sure about the using .htaccess. But if it's an issue for him it would also be for other customers, maybe we can get them to change it.
    Thanks for your comments.
    EfV

    As for the two diff DOCTYPES... I grabbed the header from one site (XHTML) and then after piecing it together for him decided to lossen it up for him while he was practicing...but I'll go back and change that just to test. Thanks!
    Last edited by Eye for Video; 02-24-2010 at 10:35 AM. Reason: added another response

  6. #6
    Join Date
    Dec 2005
    Posts
    2,984
    Well, the first giveaway is the display the document when you load it up in chrome (the css sheet, I mean, not the HTML page). The one from your server is formatted and the one from his server is like something you'd see in notepad.

    So then I loaded up the both urls with firebug and, under the Net tab, click All and you'll see a request for the stylesheet. Click that request and you can see the headers that are sent with the document.

    Furthermore, Firebug has the requests divided up for you into All, HTML, CSS, JS, XHR, etc. When I load the file up on your server, the request shows up under CSS, when I load the file up on his server, it shows up under HTML.

    There you have it, all my deductions. That's definitely your problem. If you uploaded the identical files to your server as he did to his, then it's a server issue and the .htaccess fix I suggested MAY work. Otherwise, contact tech support for that server, if you can and tell them the problem.

    It has nothing to do with the HTML code because when the stylesheet is accessed directly its being served with the wrong content-type.
    Last edited by aj_nsc; 02-24-2010 at 10:36 AM.

  7. #7
    Join Date
    Mar 2006
    Posts
    172
    Quote Originally Posted by Eye for Video View Post
    The file name uses underscores
    Code:
    style_sheets/main_styles.css
    But thanks for taking a look!
    You're right, my bad. Usually you can see the underscores separate from the underlining, but I couldn't see it until I highlighted it...

  8. #8
    Join Date
    Feb 2008
    Location
    NW Washington State
    Posts
    1,856
    Looks like Index is XHTML but About Us and Links is HTML loose.
    They do not see the styles either... DANG!
    EfV

  9. #9
    Join Date
    Feb 2008
    Location
    NW Washington State
    Posts
    1,856
    Thanks all for the very promt responses and your interest!
    We've got some things to work with now.
    Best wishes,
    EfV

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles