【问题标题】:Rails 4 adding stylesheetRails 4 添加样式表
【发布时间】:2014-02-02 12:16:51
【问题描述】:

我已经在这个网站上搜索了答案,但到目前为止还没有。我处于学习曲线上:一边学习一边创建自己的 Rails 应用程序。

在我的应用程序/资产/样式表中,我有一些样式表。在公用文件夹中,我有我的 index.html 页面

我正在尝试添加一些样式表,但没有任何效果。我添加了这个:<%= stylesheet_link_tag "main" %> inside theapplication.html.erd 文件。我认为这是应该包含样式表的地方,但仍然没有。我继续放置<%= stylesheet_link_tag "main" %> inside the index.html page but it only shows entire code as text in the browser. Am I doing something wrong?

【问题讨论】:

    标签: css ruby-on-rails-4 stylesheet


    【解决方案1】:

    index.html 是一个 html 页面,它不能渲染 rails 命令,要么将文件名改为 index.html.erb 然后包含 要么使用 html 的链接标签来加载你的index.html 中的 css。

    【讨论】:

    • 啊,做到了!谢谢!!
    猜你喜欢
    • 2011-10-18
    • 1970-01-01
    • 2014-04-07
    • 1970-01-01
    • 1970-01-01
    • 2012-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多