views:

83

answers:

4
<div class="build-editor" id="section-content">
<link href="/stylesheets/upload-from-disk.css?1280508898" media="screen" rel="stylesheet" type="text/css">

<div class="attachments">
    <h1 class="at-header">Attachments</h1>
    <div class="at-options">
    .
    .
    .

In ie8 and 7, this stylesheet is never loaded... why?

+1  A: 

is your <link> placed between <head></head> tags?

nicholasklick
+5  A: 

link should only appear in the head of the document.

prodigitalson
i have other pages where link occurs in the body =\
DerNalia
it should, but it can also appear outside the head depending on the DOCTYPE and the mode the browser is in. IE is infamous for its "quirks" mode.
Scott M.
This is a good call. however, I was trying to optimize my RoR app, by having stylesheets only load when needed. but i suppose if they are cached, like good browsers do, it won't matter.
DerNalia
"I was trying to optimize my RoR app, by having stylesheets only load when needed." Well the proper way to go about this IMO would be to make a helper that you can call from your views that adds `link` or `style` tags to the head of what will be the rendered page does RoR not have something like this built in? Both Symfony and Zend do which are what i normally code with.
prodigitalson
Well, my app has a lot of AJAX.. the goal is to not have the page refresh if workflow says its better to stay where we are, and just page-replace.
DerNalia
+3  A: 

Try closing the <link> element like so...

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

I work with several projects that link in CSS from outside the <head> area, and I believe it generally works (perhaps not in IE6).

NOTE Even if it works, it is not on-spec. It's a better idea to place it in the <head> if you can.

Drew Wills
+1  A: 

if you are trying to optimize the RoR app. You can use a content_for..

for example... in your layout...

<head>
   <%= yield :head %>
 </head>

And

<% content_for :head do %>
   <%= stylesheet_link_tag 'upload-from-disk' %> 
<% end %>

in the view..

Doon