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

后端 未结 3 549
天命终不由人
天命终不由人 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:34

    Ok, here it is,

    instead of wrapping divs or spans in anchor for image links use just anchors e.g.

    
    
    

    if you using element with background image you must set both width & height and display property to block or inline-block if element is not by default block or inline block level element.

    .slo,
    .eng {
      background-repeat:no-repeat;
      position:absolute;
      display: block;
      width:5%;
      height:2%; /* You forgot to set height */
      bottom:10%;
    }
    .slo {
      background-image:url("slo.png");
      right:21%;
    }
    .eng {
      background-image:url("eng.png");
      right:12%;
    }
    

提交回复
热议问题