我试图更改包含NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:myNSDateInstance];
NSInteger year = [components year];
// NSInteger month = [components month];
NSString *yearStr = [NSString stringWithFormat:@"%ld", year];
的{{1}}的背景颜色。我试图用div
& href
财产。这似乎不起作用。我显然没有针对正确的事情。
我有以下a:target
结构。
a:visited
以下是与上述相关的CSS
nav
我有办法实现这个目标吗?
已更新
<nav id="main-nav">
<a href="#" ><div></div></a>
<a href="#" id="p1" class="current"><div>OPTION - 1</div></a>
<a href="#" id="p2"><div>OPTION - 2</div></a>
<a href="#" id="p3"><div>OPTION - 3</div></a>
<a href="#" id="p4"><div>OPTOIN - 4</div></a>
<a href="#" id="p5"><div>OPTION - 5</div></a>
</nav>
答案 0 :(得分:2)
这应该可以解决问题
struct UserHasBirthday: Event {
let name: String
init(name: String) {
self.name = name
}
}
struct UserWonTheLottery: Event {
let name: String
let amount: Int
init(name: String, amount: Int) {
self.name = name
self.amount = amount
}
}
let events = TestDispatcher()
events.listen {
(event: UserHasBirthday) in
print("Happy birthday \(event.name)!")
}
events.listen {
(event: UserWonTheLottery) in
print("Congratulations \(event.name) for winning \(event.amount)!")
}
events.push(UserHasBirthday(name: "John Doe"))
events.push(UserHasBirthday(name: "Jane Doe"))
events.push(UserWonTheLottery(name: "Jane Doe", amount: 42000))
events.flush()
/* Happy birthday John Doe!
Happy birthday Jane Doe!
Congratulations Jane Doe for winning 42000! */
:target div {
background: yellow;
}
答案 1 :(得分:1)
最简单的方法是删除div,因为它们会覆盖您在:visited和a:hover上定义的标记。 因此,如果您只是更改背景颜色,那么设置div的父母的背景颜色&#39; a&#39;将涵盖div的背景。
我假设您要突出显示带有.current类集的导航项。
c
&#13;
counter
&#13;