- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有一个黑色背景和白色文本的导航栏。将鼠标悬停在上方时,文本会变为红色。但是,当用户在选择页面上时,特定背景将变为红色。但是,将鼠标悬停在上方会将文本更改为红色。我想要它,以便当用户在主页上并将鼠标悬停在主页按钮上时,文本不会变为红色。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>TL Custom Printing</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
</head>
<body>
<div id="topbar">
</div>
<div id="navbar">
<div id="navbtn">
<ul>
<li><a href="index.php" style="background-color:#F00;">Home</a></li>
<li><a href="custom.php" >Custom Printing</a></li>
<li><a href="store.php">Products</a></li>
<li><a href="gallery.php">Gallery</a></li>
<li><a href="about.asp">About</a></li>
<li><a href="contact.asp">Contact Us</a></li>
</ul>
</div>
</div>
<div id="logo">
<img src="testlogo.png" alt="logo">
</div>
</body>
</html>
CSS:
#navbtn {
width:100%;
Margin:20px;
white-space: nowrap;
text-align:center
}
ul {
width:100%;
list-style:none;
margin:0;
padding:0;
display: inline-block;
padding-top: 2.25em;
}
li {
width: 140px;
display: inline-block;
}
a {
text-align:center;
font-size: 1.25em;
padding:8px 0;
display:block;
width:100%;
text-decoration:none;
color:#FFF;
border-top-left-radius:8px;
border-top-right-radius:8px;
}
a:hover {
color:#F00;
background-color:#000;
}
最佳答案
您可以使用事件类轻松解决此问题:JSFiddle
<li><a href="index.php" class="active">Home</a></li>
a.active {
background-color:#F00;
}
a.active:hover {
color: #fff;
}
我还将您的事件选项卡背景颜色添加到 .active
类中,删除了您的内联样式
关于html - 取消悬停在导航栏中的一个按钮的效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24738848/
我在让我的操作栏显示图标时遇到问题。它显示了我在溢出菜单中设置的文本/标题(三个点),但没有任何操作。这是我的代码,我错过了什么? MainActivity.java public class Mai
我正在尝试在 android 中制作一个动态操作栏,现在我正在尝试像这样在操作栏中进行搜索。 http://developer.android.com/images/ui/actionbar-sear
我正在编写 uiautomator 测试,但我很难弄清楚如何单击我的操作栏图标。 如果我的操作是“始终”显示,则很容易找到并点击。 如果我的操作是显示“从不”,我必须单击菜单,然后从菜单中单击。先点击
我有一个正在寻找特定 URI 的重写规则。当它匹配特定的 URL 时,它会使用正确的文件路径重写它,以便可以找到所需的内容。然后它将协议(protocol)更改为 HTTPS 并允许请求通过。 我有两
我正在为 android 中的 ActionBar 而苦苦挣扎。 这是我的问题:我的操作项没有显示在操作栏中,而是堆叠在操作溢出中,无论我做什么.. 我花了一天的时间寻找解决方案,但我似乎找不到缺少的
我的网络应用程序在 Tomcat 下运行,它非常密集地使用 AJAX 请求,在开发过程中我也必须密集地重新部署网络应用程序。重新部署后,我通常会简单地刷新页面,知道用户 session 已删除,但我总
我是一名优秀的程序员,十分优秀!