开发者

Can't get CSS to load

开发者 https://www.devze.com 2023-01-26 18:38 出处:网络
I can\'t seem to get a css file to apply its styling to a form.It is quite frustrating now because as far as I know it should work!

I can't seem to get a css file to apply its styling to a form. It is quite frustrating now because as far as I know it should work!

In my head I have

<link href="/stylesheets/formtastic.css?1290524609" media="screen" rel="stylesheet" type="text/css" /> 

and in the body I have:

<form action="开发者_StackOverflow/agents" class="formtastic agent" id="new_agent" method="post">

The formtastic.css file should apply styling to the form. It's contents are viewable here: formtastic.css

Any suggestions or fixes?


The problem was that the following code was not inserted in the form:

<% f.inputs do %>

This creates the html and now the css works.

i.e. the html missing was


dont you need to turn that number into a querysting var?

<link href="/stylesheets/formtastic.css?math=1290524609" media="screen" rel="stylesheet" type="text/css" /> 


Are you using this with Rails? If so, you could simply put this in your header:

<%= formtastic_stylesheet_link_tag %>

Also, have you run both bundle install and rails generate formtastic:install (for Rails 3, use ./script/generate formtastic for Rails 2)?


Are you sure the path is correct? if you check source with firebug check the link tag and see if its contents are a 404 error. It may be an issue with your root-relative path.

This is only a guess as I can't see how your site is structured.


Are you sure you have to begin with a forward slash ? (/)

Cause it's mean it's at the root of your domain.

Tried <link href="stylesheets/formtastic.css?1290524609" media="screen" rel="stylesheet" type="text/css" /> ?

0

精彩评论

暂无评论...
验证码 换一张
取 消