如何使悬停背景的高度与菜单相同?我还不能做到这一点。
<div id="menu">
<ul>
<li> <a href="">Home</a></li>
<li> <a href="">About us</a></li>
<li> <a href="">Benefits</a></li>
<li> <a href="">How it Works</a></li>
<li> <a href="sex">Contact us</a></li>
<li> <a href="">Get Started</a></li>
</ul>
</div>
Css从这里开始
#menu {
text-decoration: none;
display: list-item;
background-color: cadetblue;
height: 60px;
}
#menu ul {
list-style-type: none;
margin: 0;
}
#menu ul li {
float: left;
height: auto;
padding-left: 100px;
font-family: sans-serif;
font-size: 60x;
}
#menu ul li a {
text-decoration: none;
color: white;
}
#menu ul li a:hover {
background-color: darkcyan;
height: 60px;
}
我在这里错过了位置标记吗?
答案 0 :(得分:0)
您已将Hover用于ancho
r标记。然后它只会影响锚标记。如果您想要完全填充,只需将hive悬停到li
标记
<style type="text/css">
#menu {
text-decoration: none;
display: list-item;
background-color: cadetblue;
height: 60px;
}
#menu ul {
list-style-type: none;
margin: 0;
}
#menu ul li {
display: inline-block;
padding:1%;
height: 60px;
padding-left: 100px;
font-family: sans-serif;
font-size: 60x;
}
#menu ul li a {
text-decoration: none;
color: white;
}
#menu ul li:hover {
background-color: darkcyan;
}
答案 1 :(得分:0)
只需将"line-height"
放入a:
悬停。
您设置了height: auto;
请改变它并给它一些高度。
例如,如果您提供 10px高度,则设置"line-height: 10px;"
如果你这样做了,那么你会看到相同的高度..
答案 2 :(得分:0)
你可以这样做:
from scrapy.spiders import Spider
from scrapy.selector import Selector
from imdb.items import ImdbItem
class ImdbSpider(Spider):
name = "imdb"
allowed_domains = ["imdb.com"]
start_urls = [
"http://www.imdb.com/title/tt0068646/reviews?ref_=%20best",
]
def parse(self, response):
sel = Selector(response)
sites = sel.xpath('//div[contains(@id,"tn15content")]/p')
ratings = sel.xpath('//div[contains(@id,"tn15content")]/div/img')
items = []
for site in sites:
item = ImdbItem()
item['review'] = site.xpath('text()').extract_first()
items.append(item)
for rating in ratings:
item = ImdbItem()
item['rating'] = rating.xpath('@alt').extract_first()
items.append(item)
return items