css中如何将一张图片放于背景图片正中

来源:百度知道 编辑:UC知道 时间:2024/06/19 03:23:48

如果是加入背景图片,并且背景图片剧正中:
<div style="background:url(图片路径) no-repeat center center"></div>

如果不是,那么请说清楚点

<html>

<head>

<title>无标题文档</title>

<style>

div

{

wdith:470px;

height:80px;

background:url(http://eiv.baidu.com/mc_files/20090227/20090227182703_49861100T1T396485.gif) no-repeat 0 0;

padding:5px 0 5px 100px;

}

img

{

width:80px;

height:80px;

}

</style>

</head>

<body>

<div>

<img src="http://www.baidu.com/search/zhidao/img/p2.jpg"; alt="" />

</div>

</body>

</html>

你要的是下面这种效果吗?