Adding a background image to a
element

后端 未结 9 943
无人及你
无人及你 2020-11-28 04:09

Is it possible to make a

element contain a background image, and if so, how would I go about doing this?

9条回答
  •  粉色の甜心
    2020-11-28 04:38

    Use this style to get a centered background image without repeat.

    .bgImgCenter{
        background-image: url('imagePath');
        background-repeat: no-repeat;
        background-position: center; 
        position: relative;
    }
    

    In HTML, set this style for your div:

提交回复
热议问题