Home >Web Front-end >HTML Tutorial >How to center the background of

layer horizontally and vertically?_html/css_WEB-ITnose

How to center the background of
layer horizontally and vertically?_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:25:101109browse

HTML CSS

dc6dce4a544fdca2df29d5ac0ea9906b How to center the background horizontally and vertically?
The code is as follows:
<style>.ft_br{  width:1190px;  height:250px;  margin:0 auto;  padding:0;  backgroud:url(./images/ft.gif) no-repeat;/* 背景图片的尺寸是160px*50px的*/}</style><div class="ft_br"></div>

Reply to discussion (solution)

Setting the background is more demanding, you can use two layers of

valign: Add this to center div

valign: Add this to center div and don’t forget to tie it

backgroud:url(./images/ft.gif) center center no-repeat;
That is, the background-postion:center center;

backgroud:url(./images/ft.gif) center center no-repeat;
That is the background-postion: center center;

Well, I didn’t think about it for a moment, haha, it’s been solved. .
Thank you. .

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn