【发布时间】:2014-12-29 21:12:00
【问题描述】:
嗨,我不太擅长css。我想创建一个页面,在单击菜单选项后,该选项的边框底部变为蓝色。我当前的代码适用于鼠标悬停和活动,但在我离开鼠标后不起作用。 CSS 代码:
body
{
background-image: url("images/temp1.jpg");
background-size: 100% 100%;
background-attachment: fixed;
}
.container
{
text-align: center;
}
.center_div
{
margin-left: 12%;
width: 75%;
height: 100%;
background-color: #ffffff;
}
td.mainmenu
{
border-style: hidden;
width: 15%;
height: 10%;
border-collapse: separate;
border-spacing: 3%;
padding:20px;
padding-left:60px;
}
a.mainmenu
{
text-decoration:none;
color: black;
}
td.mainmenu:hover
{
border-bottom-style:solid;
border-bottom-color:blue;
}
HTML 代码:
<html>
<head>
<link rel="stylesheet" href="admin_template.css">
</head>
<body>
<div class="container">
<div class="center_div">
<table class="mainmenu">
<tr>
<td class='mainmenu'><a class='mainmenu' href="">Sales</a></td>
<td class='mainmenu'><a class='mainmenu' href='out_of_stocks.php'>Out of Stocks</a></td>
<td class='mainmenu'><a class='mainmenu' href='refill_stock.php'>Refill Stocks</a></td>
<td class='mainmenu'><a class='mainmenu' href='enter_product.php'>New products</a></td>
<td class='mainmenu'><a class='mainmenu' href='admin_so.php'>Sign Out</a></td>
</tr>
<table>
<hr/>
</div>
</div>
</body>
</html>
`
【问题讨论】:
-
这篇文章也可能是相关的:stackoverflow.com/questions/7566238/…