我希望標籤選項卡與鼠標懸停時的搜索選項卡具有相同的背景,我該怎麼做?當鼠標移過選定的選項卡時,需要更改背景。怎麼樣?
我有搜索選項卡已經有一個默認的背景,但當點擊標籤時我怎麼能得到相同的背景是在搜索出現在標籤?
HTML:
<html>
<head>
<link href="arg.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="tab-item tab-selected" id="search-box">
Search
</div>
<div class="tab-item" id="tag-box">
Tags
</div>
</body>
</html>
CSS:
.tab-item {
-moz-border-radius: 10px;
border-radius: 10px;
font: 14px helvetica;
color: #000;
height: 20px;
float: left;
margin: 5px 5px 5px 5px;
padding: 5px 5px 5px 5px;
position: relative;
width: 75px;
}
.tab-mouseover {
background: #bdbdbd;
}
.tab-selected {
background: #c0c0c0;
}
非常感謝!順便說一句我不是最好的CSS ..我如何將兩個標籤旁邊的CSS在中心彼此對齊?當我將對齊方式更改爲中心時,將一個選項卡放在另一個選項卡上 – James
沒問題。使用'margin:0 auto;'以及指定的'width.' http://jsfiddle.net/mrtsherman/7FvR5/1/ – mrtsherman