我有十二個<a href>
鏈接,導致不同的類別。作爲用戶定位的手段,我想強調用戶現在正在使用的類別(<a href>
-button)。CSS selected/active property
我該如何在CSS中實現這個功能?我讀了selected
和active
,但我還沒有能夠使它工作。
這是鏈接/按鈕之一:
<a href="index.php?category=handy&location=&sort="><span class="category_item"></span><span class="category_description">Handy & Co.</span></a>
相應的CSS:
.category_item {
display:inline-block;
background:url(../img/category_item/ph.png) no-repeat;
width: 45px;
height: 45px;
margin-right: 11px;
margin-bottom: 20px;
}
.category_item:hover {
background:url(../img/category_item/hover.png);
}
.category_description {
position: absolute;
font-size: 11px;
color: #000;
margin-top: 43px;
margin-left: -62px;
z-index: 1;
opacity: 0;
}
預先感謝您!
需要比CSS以外的東西來做到這一點。有些東西必須將該類應用於將其設置爲當前頁面鏈接的鏈接。 – 2014-12-04 20:07:56