用CSS改变圆角按钮的颜色
提前谢谢大家!
我能够使用 CSS 制作一个圆角按钮。我喜欢能够将鼠标悬停在按钮上,整个东西都会改变其颜色,而不仅仅是最里面的 div。请帮忙!
我的假设是 iam 应该有一些带有 onmouseover="" 的 javascript,对吗?
这是页面:http://biozenconsulting.com/new/
(另外,我如何摆脱在 IE8 和 Chrome 中查看时出现在右上角的小框?)
这是 HTML 代码:
<div class="nav_menu" onclick="location.href='index.htm'">
<b class="top_menu"><b class="top_menu1"><b></b></b><b class="top_menu2"><b></b></b><b class="top_menu3"></b><b class="top_menu4"></b><b class="top_menu5"></b></b>
<div class="top_menufg">
<!-- content goes here -->
Home
</div>
<b class="top_menu"><b class="top_menu5"></b><b class="top_menu4"></b><b class="top_menu3"></b><b class="top_menu2"><b></b></b><b class="top_menu1"><b></b></b></b>
</div>
这是 CSS:
.nav_menu {
text-align: center;
color: #353535;
font-size: 20pt;
font-family: Verdana, Geneva, sans-serif;
float: left;
width: 33%;
}
#about {
margin: 0 .5% 0 .5%;
}
<!-- For rounded boxes -->
.top_menu {
display:block
overflow: hidden;
}
.top_menu *{
display:block;
height:1px;
overflow:hidden;
font-size:.01em;
background:#AAAAAA
}
.top_menu1{
margin-left:3px;
margin-right:3px;
padding-left:1px;
padding-right:1px;
border-left:1px solid #AAAAAA;
border-right:1px solid #AAAAAA;
background:#AAAAAA
}
.top_menu2{
margin-left:1px;
margin-right:1px;
padding-right:1px;
padding-left:1px;
border-left:1px solid #AAAAAA;
border-right:1px solid #AAAAAA;
background:#AAAAAA
}
.top_menu3{
margin-left:1px;
margin-right:1px;
border-left:1px solid #AAAAAA;
border-right:1px solid #AAAAAA;
}
.top_menu4{
border-left:1px solid #AAAAAA;
border-right:1px solid #AAAAAA
}
.top_menu5{
border-left:1px solid #AAAAAA;
border-right:1px solid #AAAAAA
}
.top_menufg{
background:#AAAAAA
}
.top_menufg:hover{
background-color: #888888;
cursor: pointer;
}
<!-- For rounded boxes -->
thanks a bunch in advance!
i was able to make a rounded corner button using CSS. i like to be able to mouseover the button, and the entire thing changes its color, not just the inner most div. plz help!
my assumption is that iam supposed to have some kinda javascript with onmouseover="", correct?
here's the page: http://biozenconsulting.com/new/
(also, how do i get rid of the small boxes that appear on the right corners when viewed in IE8 and Chrome?)
this is the HTML code:
<div class="nav_menu" onclick="location.href='index.htm'">
<b class="top_menu"><b class="top_menu1"><b></b></b><b class="top_menu2"><b></b></b><b class="top_menu3"></b><b class="top_menu4"></b><b class="top_menu5"></b></b>
<div class="top_menufg">
<!-- content goes here -->
Home
</div>
<b class="top_menu"><b class="top_menu5"></b><b class="top_menu4"></b><b class="top_menu3"></b><b class="top_menu2"><b></b></b><b class="top_menu1"><b></b></b></b>
</div>
and here's the CSS:
.nav_menu {
text-align: center;
color: #353535;
font-size: 20pt;
font-family: Verdana, Geneva, sans-serif;
float: left;
width: 33%;
}
#about {
margin: 0 .5% 0 .5%;
}
<!-- For rounded boxes -->
.top_menu {
display:block
overflow: hidden;
}
.top_menu *{
display:block;
height:1px;
overflow:hidden;
font-size:.01em;
background:#AAAAAA
}
.top_menu1{
margin-left:3px;
margin-right:3px;
padding-left:1px;
padding-right:1px;
border-left:1px solid #AAAAAA;
border-right:1px solid #AAAAAA;
background:#AAAAAA
}
.top_menu2{
margin-left:1px;
margin-right:1px;
padding-right:1px;
padding-left:1px;
border-left:1px solid #AAAAAA;
border-right:1px solid #AAAAAA;
background:#AAAAAA
}
.top_menu3{
margin-left:1px;
margin-right:1px;
border-left:1px solid #AAAAAA;
border-right:1px solid #AAAAAA;
}
.top_menu4{
border-left:1px solid #AAAAAA;
border-right:1px solid #AAAAAA
}
.top_menu5{
border-left:1px solid #AAAAAA;
border-right:1px solid #AAAAAA
}
.top_menufg{
background:#AAAAAA
}
.top_menufg:hover{
background-color: #888888;
cursor: pointer;
}
<!-- For rounded boxes -->
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Stu Nicholls 的网站 css play 有很多关于如何在不使用 JavaScript 的情况下执行此操作的示例。这真是一个非常好的资源。
Stu Nicholls's site css play has a lot of examples of how to do this without javascript. It's a really excellent resource.
我用链接替换了外部 div,并添加了一些 CSS。
HTMLCSS
I replaced the outer div with a link and added a little bit of CSS.
HTML
CSS