-6ren"> -当用户退出我的网站时,我会收到以下通知。 def destroy session[:user_id] = nil redirect_to root_url, :notice => "Logge-6ren">
gpt4 book ai didi

css - 更改 rails 的字体样式 "notices"=>

转载 作者:行者123 更新时间:2023-11-28 15:24:29 25 4
gpt4 key购买 nike

当用户退出我的网站时,我会收到以下通知。

def destroy
session[:user_id] = nil
redirect_to root_url, :notice => "Logged out!"
end

只有轻微的小问题,“已退出!”注意是无字体样式,而不是更符合我的网站的字体样式(即 font-family: sans-serif)。

我该如何改变这个...?

也许:

def destroy
session[:user_id] = nil
redirect_to root_url, :notice => <div class="some_class">"Logged out!</div>
end

然后我们可以在 css 中编辑 .some_class 类...

这是 application.html.crb 代码:

<!DOCTYPE html>
<html>
<head>
<title>Welcome!</title>

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>

</head>

<body>

<!--<div id="user_nav">
<% if current_user %>
Logged in as <%= current_user.email %>.
<%= link_to "Log Out", log_out_path %>
<% else %>
<%= link_to "Sign Up", sign_up_path %> or
<%= link_to "Log In", log_in_path %>
<% end %>
</div>-->

<% flash.each do |name, msg| %>
<%= content_tag :div, msg, :id => "flash_#{name}" %>
<% end %>

<%= yield %>

</body>

</html>

最佳答案

在 application.html.crb 中,编辑以下内容:

<div class="flash">
<% flash.each do |name, msg| %>
<%= content_tag :div, msg, :id => "flash_#{name}" %>
<% end %>
</div>

关于css - 更改 rails 的字体样式 "notices"=>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28787463/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com