gpt4 book ai didi

html - 响应式样式表上的背景图片不起作用

转载 作者:太空宇宙 更新时间:2023-11-03 23:52:12 24 4
gpt4 key购买 nike

我的目标是始终填满页面的响应式背景图片,但目前,我的图片甚至无法加载!如果有人能提供帮助,那就太好了。

http://jsfiddle.net/totneschap/mNKp4/

这是我的 html:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tobys Vintage Hire in Exeter, Devon</title>

<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
<link href="http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Limelight' rel='stylesheet' type='text/css'>
<link href="assets/css/style.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="description" content="Based in Exeter, Tobys Vintage Hire supplies vintage and floral goods for weddings or for prop hire.">
<meta name="keywords" content="Vintage Hire, Prop Hire, Wedding Hire, Vintage, Exeter, Devon, Prop, Props, Wedding, Design,">
</head>
<body>
<div class="container">
<div class="row">
<div class="span12">
<img src="assets/images/header.jpg">
</div>
</div>
</div>
</div>
<div id="navcontainer">
<ul id="navlist">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Items for Hire</a></li>
<li><a href="#">Packages</a></li>
<li><a href="#">Gallery</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</body>
</html>

这是我的CSS:

body{
width:100%;
height:100%;
background-image: url('assets/images/texture.jpg') center center no-repeat;
background-position: center center;
background-repeat: no-repeat;
}

#navcontainer ul
{
padding: .2em 0;
margin: 0;
list-style-type: none;
width: 100%;
color: #000b00;
font-family: 'Limelight', cursive;
font-size: 1.250em;
text-align: center;
}

li {
display: inline;
}

li a
{
padding: .2em 1em;
color: #000;
}

li a:hover
{
color: #00fc45;
text-decoration: none;
}

最佳答案

只是一件小事:)
你不能使用 no-repeat 和 center on background-image^^
这是 fiddle :
http://jsfiddle.net/mNKp4/2/

body{
width:100%;
height:100%;
/* background-image: url('assets/images/texture.jpg') center center no-repeat; */
background-image: url('assets/images/texture.jpg'); /*background-image, so no repeat */
background-position: center center;
background-repeat: no-repeat;
}

关于html - 响应式样式表上的背景图片不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19645153/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com