我的问题很简单。我已将我的代码放在这个小提琴上:http://jsfiddle.net/G79X9/61/
.historyContainer{
margin-top: 45px;
width: 856px;
margin: 29px auto;
}
.depositContainer :nth-child(even)
{
background-color: green;
}
.depositContainer :nth-child(even)
{
background-color: red;
}
.withdrawContainer :nth-child(even)
{
background-color: red;
}
.withdrawContainer :nth-child(even)
{
background-color: green;
}
.offerHistory1{
width: 50%;
float: left;
text-align: center;
background-color: #cdc;
}
.offerHistory2{
width: 50%;
float: left;
text-align: center;
background-color: #dcd;
}
.depositHistory{
width: 50%;
float: left;
}
.withdrawHistory{
width: 50%;
float: right;
}
我只是希望divs背景被删除"(一个用一种颜色,另一种用另一种颜色)。我认为这应该有用,但它不是。
答案 0 :(得分:3)
那么这样吗?
function geocodeAddress(address, callback) {
var geocoder = new google.maps.Geocoder();
geocoder.geocode({ address: address }, function(results, status) {
if (status === google.maps.GeocoderStatus.OK) {
if (results.length > 0) {
callback(results[0].geometry.location);
} else {
console.log("No results found");
}
} else {
console.log("Geocoder failed due to: " + status);
}
});
}
function getLatLng(address, callback) {
latLng = [];
geocodeAddress(address, function(position) {
latLng.push(position.lat());
latLng.push(position.lng());
callback(latLng);
});
}
CSS代码......
<div class="historyContainer">
<div class="offerHistory1">Deposit</div>
<div class="offerHistory2">Withdraw</div>
<div class="depositHistory">
<div class="depositContainer"><b>ID: 25 - Status: </b>Forbiden: Trade hold</div>
<div class="depositContainer"><b>ID: 24 - Status: </b>Forbiden: Trade hold</div>
</div>
<div class="withdrawHistory">
<div class="withdrawContainer"><b>ID: 38 - Status: </b>coins refunded</div>
</div>
</div>
答案 1 :(得分:3)
你的代码中有两个错误:
1。)不要在伪类之前留空:不是.depositContainer :nth-child(even)
,而是.depositContainer:nth-child(even)
2。)你必须在&#34; odd&#34;之间交换。和&#34;甚至&#34;在伪类之后的括号中