How to make Header image responsive?

后端 未结 1 1337
春和景丽
春和景丽 2021-01-15 18:15

I have added a header image to my site with:

#header_area {
    background: url(\'my_header_image.com\');
    background-repeat:no-repeat;
    background-pos         


        
1条回答
  •  太阳男子
    2021-01-15 18:21

    When making a background-image responsive, you can use the background-size property. In the case of the above code, so long as your #header_area element has an implicit width (or an explicit one set with media queries), you should be able to say:

    #header_area {
        background: url('my_header_image.com');
        background-repeat:no-repeat;
        background-position: top center;
        background-size: 100%;
    }
    

    0 讨论(0)
提交回复
热议问题