Sass 更改类别=";主动的;背景色
这是一个分为两部分的问题,尽管我相信其中一个问题的答案很可能会阐明第二个问题,如果不能解决它的话Sass 更改类别=";主动的;背景色,sass,zurb-foundation,Sass,Zurb Foundation,这是一个分为两部分的问题,尽管我相信其中一个问题的答案很可能会阐明第二个问题,如果不能解决它的话 我使用Rails 3.2.13的基础4,让它工作。我更改了顶部栏的背景色,但是鼠标悬停时链接仍然变为深灰色,并且只有一个链接是活动链接,即当在主页上“主页”链接有一个class=“active”li元素标记中的属性仍然是深灰色,而不是我的导航条背景颜色的较深版本。我已尝试将自己的.active{background color:#f00;}添加到全局css文件中,它将更改页面内容区域中的h1元素,但
我使用Rails 3.2.13的基础4,让它工作。我更改了顶部栏的背景色,但是鼠标悬停时链接仍然变为深灰色,并且只有一个链接是活动链接,即当在主页上“主页”链接有一个
class=“active”li
元素标记中的
属性仍然是深灰色,而不是我的导航条背景颜色的较深版本。我已尝试将自己的.active{background color:#f00;}
添加到全局css文件中,它将更改页面内容区域中的h1
元素,但不会更改导航栏中的链接。我已经编辑了$top bar
和$section
(因为链接实际上包含在section div中)变量,但没有任何更改
就我的一生而言,我似乎无法更改活动或悬停背景色。我确信我错过了一些非常简单的东西,但似乎无法找到它
你能提供的任何帮助都会很棒。
谢谢
帕特里克
下面是一些相关的代码
foundation_and_overrides.scss
...
//
// Section Variables
//
// We use these to set padding and hover factor
$section-padding: emCalc(15px);
$section-function-factor: 10%;
// These style the titles
$section-title-color: #333;
$section-title-bg: #eee;
$section-title-bg-active: darken($section-title-bg, $section-function-factor);
$section-title-bg-active-tabs: #fff;
// Want to control border size, here ya go!
$section-border-size: 1px;
$section-border-style: solid;
$section-border-color: #ccc;
// Control the color of the background and some size options
$section-content-bg: #fff;
$section-vertical-nav-min-width: emCalc(200px);
$section-bottom-margin: emCalc(20px);
...
//
// Top Bar Variables
//
// Background color for the top bar
// $topbar-bg: #111;
$topbar-bg: #008000;
// Height and margin
// $topbar-height: 45px;
$topbar-height: 75px;
// $topbar-margin-bottom: emCalc(30px);
// Control Input height for top bar
// $topbar-input-height: 2.45em;
// Controlling the styles for the title in the top bar
// $topbar-title-weight: bold;
// $topbar-title-font-size: emCalc(17px);
$topbar-title-font-size: emCalc(28px);
// Set the link colors and styles for top-level nav
// $topbar-link-color: #fff;
// $topbar-link-weight: bold;
// $topbar-link-font-size: emCalc(13px);
$topbar-link-font-size: emCalc(18px);
/* copied from website */
$topbar-link-color: #eee;
$topbar-link-color-hover: #00f;
$topbar-link-color-active: #0f0;
$topbar-link-weight: bold;
$topbar-link-font-size: emCalc(18px);
$topbar-link-hover-lightness: -30%; /* Darken by 30% */
$topbar-link-bg-hover: darken($topbar-bg, 3%);
$topbar-link-bg-active: darken($topbar-bg, 3%);
/* =================== */
// Style the top bar dropdown elements
// $topbar-dropdown-bg: #333;
// $topbar-dropdown-link-color: #fff;
// $topbar-dropdown-toggle-size: 5px;
// $topbar-dropdown-toggle-color: #fff;
// $topbar-dropdown-toggle-alpha: 0.5;
// $dropdown-label-color: #555;
// Top menu icon styles
// $topbar-menu-link-transform: uppercase;
// $topbar-menu-link-font-size: emCalc(13px);
// $topbar-menu-link-weight: bold;
// $topbar-menu-link-color: #fff;
// $topbar-menu-icon-color: #fff;
// $topbar-menu-link-color-toggled: #888;
// $topbar-menu-icon-color-toggled: #888;
// Transitions and breakpoint styles
// $topbar-transition-speed: 300ms;
// $topbar-breakpoint: emCalc(940px); // Change to 9999px for always mobile layout
// $topbar-media-query: "only screen and (min-width "#{$topbar-breakpoint}")";
@import 'foundation';
这是我的全局应用程序scss文件
app_styles.scss
@进口"基础",
#error_explanation {
@include alert;
width: 450px;
border: 2px solid #c00;
padding: 7px;
padding-bottom: 0;
margin-bottom: 20px;
background-color: #e4d2d2;
h2 {
text-align: left;
font-weight: bold;
padding: 5px 5px 5px 15px;
font-size: 1em;
margin: -7px;
margin-bottom: 0px;
background-color: #c00;
color: #fff;
}
ul li {
color: #c00;
margin: 5px 5px -10px 15px;
font-size: 12px;
list-style: square;
}
}
.active {
background-color: #f00;
}
这是我的应用程序布局文件中的导航栏
<nav class="top-bar">
<ul class="title-area">
<!-- Title Area -->
<li class="name">
<h1><%= link_to "Checkbook", root_url %></h1>
</li>
<!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
<li class="toggle-topbar menu-icon"><a href="#"><span></span></a></li>
</ul>
<section class="top-bar-section">
<!-- Left Nav Section -->
<ul class="left">
<%= render "nav_bar" %>
</ul>
<!-- Right Nav Section -->
<ul class="right">
<% if current_user %>
<li><%= link_to "Welcome back " + current_user.display_name, current_user %></li>
<li class="divider"></li>
<li><%= link_to "Log Out", log_out_path %></li>
<% else %>
<li><%= link_to "Log in", log_in_path %></li>
<li class="divider"></li>
<li><%= link_to "Sign up", new_user_url %></li>
<% end %>
</ul>
</section>
</nav>
-
这是主页链接
<li class="active"></li>
<% if current_user and current_user.is_admin? %>
<li class="divider"></li>
<li><%= link_to "Users", users_path %></li>
<% end %>
<% if current_user %>
<li class="divider"></li>
<li><%= link_to "Portfolios", portfolios_path %></li>
<% end %>
这就是我提到的内容,它使用h1元素中的class=“active”进行更改
<div class="active">
<h1 class="">Welcome...</h1>
</div>
欢迎
如果您想查看其他内容,请告诉我。将此内容放入您的全局css以更改背景顶栏li活动:
.top-bar-section ul li.active > a {
background: #0f0;
}
我已经尝试过了,它的工作。在检查了所有变量并更改了周围的颜色后,我发现$topbar dropdown bg是更改class=“active”属性的一个,但仍然找不到悬停。抱歉,我来不及回答您的问题,当我把它放在Aptudio.HTML.Erb文件中时,我没有收到通知,所以必须有一些调用基础的东西。CSS再次覆盖这个。非常感谢你!这给了我一个改变其他一些风格的起点。