+ -
当前位置:首页 → 问答吧 → <div>和<css> 这背景图片显示不完全啊,div内有一行内容,才显示一行背景,我希望全显背景怎么搞啊

<div>和<css> 这背景图片显示不完全啊,div内有一行内容,才显示一行背景,我希望全显背景怎么搞啊

时间:2011-08-06

来源:互联网

大家有遇到这样问题吗
div.header { background-image:url("image/header.jpg"); width="700px"; height="500px";background-repeat:no-repeat;
  background-position:center;position:absolute}
这是DIV的一个设置,怎么改呢

作者: zc1821   发布时间: 2011-08-06

大概是你的背景图片比容器小,又设置了background-repeat:no-repeat;,要让背景图占满整个容器,这样试试:
CSS code
div.header {
    background-image:url("image/header.jpg");
    width="700px";
    height="500px";
    background-repeat:repeat;
    position:absolute;
}

作者: T5500   发布时间: 2011-08-06

CSS code
div.header {
    background-image:url(image/header.jpg);
    width:"700px";
    height:"500px";
    background-repeat:repeat;
    position:absolute;
}

作者: T5500   发布时间: 2011-08-06

我的图片是1024,236的,我改成这也不行。求解啊。着急啊。
就是个网站的导航部分, 我想背景图片的,在上面链接几个导航的。 
div.header {
  background-image:url(image/header.jpg);
  width:"1024px";
  height:"236px";
  background-repeat:repeat;
  position:absolute;
}

作者: zc1821   发布时间: 2011-08-06

CSS code
/*容器尺寸显示出来是不对的吧,高宽属性值的引号去掉再试试:*/
div.header {
  background-image:url(image/header.jpg);
  width:1024px;
  height:236px;
  background-repeat:repeat;
  position:absolute;
}

作者: T5500   发布时间: 2011-08-06

大哥太谢谢你了。出来了
怎么就出来了呢

作者: zc1821   发布时间: 2011-08-06

热门下载

更多