Set size on background image with CSS?

后端 未结 18 1533
野性不改
野性不改 2020-11-22 12:38

Is it possible to set the size of the background image with CSS?

I want to do something like:

background: url(\'bg.gif\') top repeat-y;
background-si         


        
18条回答
  •  情话喂你
    2020-11-22 13:17

    For example:
    Background image will always fit to container size (width 100% and height 100px).
    Cross-browser CSS:

    .app-header {
    background: url("themes/default/images/background.jpg") no-repeat;
    -moz-background-size: 100% 100px;
    -webkit-background-size: 100% 100px;
    -o-background-size: 100% 100px;
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src = "themes/default/images/background.jpg", sizingMethod = 'scale');
    background-size: 100% 100px;
    

    }

提交回复
热议问题