/ *我不知道为什么我的代码不会显示我的背景。请帮忙
header {
z-index: 1;
position: relative;
background: #fff;
padding-bottom: 15px; {
header .banner {
background: url("http://www.hhbeautysupply.com/modules/blockbanne/img/2ff10e96da748ecea3b41289ad8dfb39.jpg") repeat-x #891C21;}
}
}
答案 0 :(得分:1)
您的元素import pygame
# === constants ===
SIZE = (800, 600)
WHITE = (255,255,255)
# === functions ===
def display_slide(screen, filename):
# --- read slide ---
image = pygame.image.load(filename)
# --- display ---
#screen.fill(WHITE)
screen.blit(image, (0,0))
pygame.display.flip()
# --- get keypress ---
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_c:
running = False
# === main ===
# --- init ---
pygame.init()
screen = pygame.display.set_mode(SIZE)
# --- slides ---
display_slide(screen, 'menu.png')
display_slide(screen, 'disclaimer.png')
# --- the end ---
pygame.quit()
需要.banner
和height
规则。
进一步:你的css格式不正确(除非你使用像sass这样的预处理器)它应该是这样的:
width
<强> DEMO 强>
header {
z-index: 1;
position: relative;
background: #fff;
padding-bottom: 15px;
}
header .banner {
background: url("http://www.hhbeautysupply.com/modules/blockbanne/img/2ff10e96da748ecea3b41289ad8dfb39.jpg") repeat-x #891C21;
//height and width rules
}
&#13;
div {
background: red;
padding: 10px;
}
.foo {
background: url("http://lorempixel.com/400/200/") repeat #891C21;
height: 200px;
width: 100%;
}
&#13;