background-image on divs aren't showing; the divs are collapsing instead

后端 未结 3 607
天命终不由人
天命终不由人 2021-01-26 10:01

CSS:

body {
  background: url(\"ninabg.jpg\") left top no-repeat;
  background-size: 100% auto;
}

.image {
    background-repeat:no-repeat;
    background-image         


        
3条回答
  •  忘了有多久
    2021-01-26 10:23

    The images are not working because .slo and .eng have no height or content so they, and their background-images, do not appear. Give them both a height:

    .slo {
        background-repeat:no-repeat;
        background-image:url("slo.png");
        position:absolute;
        width:5%;
        bottom:10%;
        right:21%;
        height:200px;
        display:block
    }
    
    .eng {
        background-repeat:no-repeat;
        background-image: url("eng.png");
        position:absolute;
        width:5%;
        right:12%;
        bottom:10%;
        height:200px;
        display:block;
    }
    

    And for your second problem, you can just use an element instead of a

    :

    
    
    

    Or use a element to display the images.

    JSFiddle Demo

提交回复
热议问题