如何将背景图片定位到其父元素? [英] How do I center a background image to its parent element?
本文介绍了如何将背景图片定位到其父元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用CSS background-position属性将背景图片对中到其父元素?
How do I use the CSS background-position property to center a background image to its parent element? I can only get the background image to center to the entire page.
推荐答案
background-position: center;
background-repeat: no-repeat;
适用于我。中心水平和垂直
works for me. centers horiz and vertically
这篇关于如何将背景图片定位到其父元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文