CSS中背景图怎么居中显示啊

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:center center;ba...
CSS中背景图怎么居中显示啊
locationBar{background: url(../images/yzj_location-bg.png) no-repeat center center;}
no-repeat是不循环显示repeat-x是在横向循环2014-06-21
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:center center;2015-05-28
background:url(../images/index_x.jpg) repeat-x center -100px;
repeat-x 你横向平铺还 居中显示 脑袋啊???平铺就不能 实现居中了,你改改 div的 宽度,然后 你再试试 集中平铺和 左对齐平铺 和 右对齐平铺,估计区别不是很大,再不行 你就把图改改宽度。。2014-06-21
mengvlog 阅读 65 次 更新于 2025-12-16 06:03:29 我来答关注问题0
檬味博客在线解答立即免费咨询

CSS相关话题

Copyright © 2023 WWW.MENGVLOG.COM - 檬味博客
返回顶部