A. 求CSS高手 背景图怎么弄成居中
现在看这个代码和你的空间,这个图片是居中的。
浏览器在1024X768显示模式下的正常浏览为1004宽,如果想将图片再靠左点,将图片裁至1004宽。
B. CSS 如何 让背景图片居中
background-position:center;
<!doctypehtml>
<html>
<head>
<metacharset="utf-8">
<title>无标题文档</title>
<styletype="text/css">
#t{
margin:50pxauto;
border:1pxsolidred;
width:700px;
height:200px;
background-image:url(1.png);
background-repeat:no-repeat;
background-position:center;
}
</style>
</head>
<body>
<divid="t">
</div>
</body>
</html>
C. div+css 背景图垂直居中
div+css实现背景图片居中;
首先设置一个div区域,定义一个最外围的区域块,然后再次设置一个小的div区域在其css样式里设置一个背景图片,让小的div区域居中即可:属性:margi:0 auto;
<!DOCTYPEhtml>
<html>
<head>
<metacharset="gb2312"/>
<title>效果区</title>
</head>
<body>
<style>
.main{width:100%;height:500px;background-color:#06F;}
.bjimg{background:url(111111.png)no-repeat;width:525px;height:300px;margin:0auto;}
</style>
<divclass="main">
<divclass="bjimg">
</div>
</div>
</body>
</html>
实现效果网页区域:
标签以及属性详解:
外围div样式取名main:设置一个宽度为100%,高度height:500px的区域让其背景颜色background-color:#06F;蓝色,这样可以更好的浏览效果;
内部的一个小的区域div取名:bjimg,区域大小就是图片的大小;设置一张背景图片,background:url(111111.png) no-repeat;,
margin:0 auto; 让其在大区域块中左右居中,上下设置为0,当然如果感觉太靠上了可以将其值(0)修改一下,数值越大距离越远
D. div+css中,怎样让一个div里面的背景图片垂直居中
给div加属性 div{background:url(图片) center center no-repeat;}
如果背景图在左面 div{background:url(图片) left center no-repeat;}
........
E. css如何使背景图片水平居中
方法和详细的操作步骤如下:
1、第一步,打开前端开发工具,然后创建一个新的html代码页,见下图,转到下面的步骤。
F. div+css中一个背景图片,如何让图片在背景图片上垂直居中
<style type="text/css">
.box {
/*非IE的主流浏览器识别的垂直居中的方法*/
display: table-cell;
vertical-align:middle;
/*设置水平居中*/
text-align:center;
/* 针对IE的Hack */
*display: block;
*font-size: 175px;/*约为高度的0.873,200*0.873 约为175*/
*font-family:Arial;/*防止非utf-8引起的hack失效问题,如gbk编码*/
width:200px;
height:200px;
border: 1px solid #eee;
width:100px;
height:100px;
}
.box img {
/*设置图片垂直居中*/
vertical-align:middle;
cursor:pointer;
}
</style>
本文来自: PQ秀秀网(http://www.pqshow.com) 详细出处参考:http://www.pqshow.com/design/htmlcss/200912/12739.html
G. 怎么修改背景图片居中并自适应宽度的css
在CSS中加入
margin-right:
auto;
margin-left:
auto;
意思是header这个框架左右自动对齐,这样header这个框架中的背景图片也就跟着居中了
H. css,如何使整个页面背景图片居中
css使整个页面背景图片居中,你是可以给一个总的div设置好一定的width和height,然后给它来设置背景图片,在通过margin让他们居中,同时,background的repeat来平铺实现,具体代码:
<html>
<head>
<style>
#div1{
width:960px;
height:1200px;
border:1pxsoild#f00;
background:url('图片地址')repeat0px0px;
margin:0auto;
}
</style>
</head>
<body>
<divid='div1'>
</div>
</body>
</html>
I. CSS+Div中怎么将背景图片居中啊,我有一个图片宽 2000(因为有背静效果所以这么宽)
body{
margin:0px;
padding:0px;
font-size:12px;
background:url(images/bg.jpg) center center no-repeat ;
}
两个 center分别表示横向坐标、纵向坐标;no-repeat 表示图片不平铺
J. CSS中背景图怎么居中显示啊
css中有一个background-position 属性设置背景图像的起始位置。
他有以下可能的值:
1,top left 左上角
2,top center 正上方
3,top right 右上方
4,center left 正左方
5,center center 正中
6,center right 正右方
7,bottom left 左下方
8,bottom center 正下方
9,bottom right 右下方
所以要是背景图居中显示,css里边加上下边这条属性:
background-position:centercenter;