Jquery中文网 www.jquerycn.cn
Jquery中文网 >  CSS教程  >  经典实例  >  正文 css 背景图水平、垂直居中方法

css 背景图水平、垂直居中方法

发布时间:2020-05-10   编辑:www.jquerycn.cn
jquery中文网为您提供css 背景图水平、垂直居中方法等资源,欢迎您收藏本站,我们将为您提供最新的css 背景图水平、垂直居中方法资源
本文章来给大家介绍css 背景图水平、垂直居中方法,有需要了解的同学可进入参考。

核心代码

 代码如下 复制代码

background:url(images/bg.gif) no-repeat 50% 50%;
background:url(images/bg.gif) no-repeat center center;

实例

 代码如下 复制代码

<!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”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>body背景上下左右居中</title>

<style type=”text/css”>
<!–
*{ padding:0; margin:0;}
html{ height:100%;}
body {
background: url(01300000081395124875325123568.jpg) 50% no-repeat;
height:100%;
}
–>
</style></head>

<body>
</body>
</html>

您可能感兴趣的文章:
css实现body背景图片水平垂直居中方法
css中文字图片背景图居中的方法汇总
css3实现图片在容器中等比例缩放及水平垂直居中
css 背景图水平、垂直居中方法
css实现在div水平垂直居中与图片水平居中的效果
CSS语法手册五颜色和背景属性
DIV CSS布局中的居中问题
CSS创建各栏同高的多栏布局
css中固定高度容器内的图片垂直水平居中的实例
基于jQuery实现的水平和垂直居中的div窗口

[关闭]