Adding a background image to a
element

后端 未结 9 910
无人及你
无人及你 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:46
    <div class="foo">Foo Bar</div>
    

    and in your CSS file:

    .foo {
        background-image: url("images/foo.png");
    }
    
    0 讨论(0)
  • 2020-11-28 04:49

    You mean this?

    <style type="text/css">
    .bgimg {
        background-image: url('../images/divbg.png');
    }
    </style>
    
    ...
    
    <div class="bgimg">
        div with background
    </div>
    
    0 讨论(0)
  • 2020-11-28 04:50
    <div id="image">Example to have Background Image</div>
    

    We need to Add the below content in Style tag:

    .image {
      background-image: url('C:\Users\ajai\Desktop\10.jpg');
    }
    
    0 讨论(0)
提交回复
热议问题