css两个背景图像 [英] css two background images

查看:140
本文介绍了css两个背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新的css的种类,但我有一个图像我想在左上角,然后另一个图像,我想重复之后。目前我累了:

Kind of new to css but I have one image I want on top left corner and then another image I want to repeat after that. Currently I tired:

CSS

#topsection{
    background: url('../images/bannerBGs.jpg');
    background-repeat:no-repeat;
    background: url('../images/bannerBGl.jpg');
    background-repeat:repeat-x;
    height: 200px; /*Height of top section*/
    color: White;
    text-align:center
}

#topsection a{
    color: #FFFF80;
}

#topsection h1{
    margin: 0;
    padding-top: 25px;
    text-align:Left
}

#topsection h2{
    margin: 0;
    padding-top: 0px;
    text-align:Center
}

HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>IG Indy Gamers</title>
<link rel="stylesheet" type="text/css" href="CSS/mycss.css" media="screen" />    
</head>
<body>
<div id="maincontainer">

<div id="topsection" > <div class="innertube">
    <h1>IG -Indy Gamers </h1>  
    <FONT style="BACKGROUND-COLOR: blue"><p align='right'><a href="#"> &nbspSignup</a> </font> / <a href='Login.html' id='LoginContent' >Login </a></p> 
    <ul id="list-nav">
        <li><a href="#">Home</a></li>
        <li><a href="#">Reviews</a></li>
        <li><a href="#">News</a></li>
        <li><a href="#">Forums</a></li>
        <li><a href="#">Demo's</a></li>
        <li><a href="#">Members</a></li>
        <li><a href="#">Contact</a></li>
    </ul>

</div></div>

但第二个图像只是复制了第一个图像。你能建议另一种方式做到这一点。

but the second image just copies over the first. Can you suggest another way to do this. I heard using layers may do it but I know nothing about that yet.

推荐答案

看起来像CSS3支持多个背景图片;您可以用逗号分隔它们:

Looks like CSS3 supports multiple background images; you specify them separated by commas:

background: url('banner1.jpg'), url('banner2.jpg');
background-position: left top, left top;
background-repeat: no-repeat, repeat;

使用 background-position 您想要什么。

IE< 9不支持此功能。

IE < 9 does not support this feature.

这篇关于css两个背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆