Background-position is not working

2

Hello everyone. I used the image-replacement technique, I tried to leave the image centered using the background-position: center center, but the position of the image remains unchanged. Someone could tell why background-positioning is not working, how can I fix it? Follow the print:

aside {
  height: 100vw;
  background-color: #fff;
  border-right: 3px solid #000;
  font-family: 'Lato', sans-serif;
  text-align: center;
  padding-top: 25px !important;
}

aside h1 {
    background-image: url(cal.png);
    background-position: center center;
    background-repeat: no-repeat;
    height: 208px;
    width: 200px;
}

aside h1 span {
    visibility: hidden;
}
<body>
   
   <div class="columns">
      
       <aside class="column is-3">
           <h1><span>Lorem ipsum</span></h1>
           
       </aside>
                   
   </div>
    
asked by anonymous 07.08.2017 / 22:54

2 answers

2

I do not know if this is fine, but width: 200px is conflicting,

aside {
  height: 100vw;
  background-color: #fff;
  border-right: 3px solid #000;
  font-family: 'Lato', sans-serif;
  text-align: center;
  padding-top: 25px !important;
}

aside h1 {
     
    background-image: url(https://i.stack.imgur.com/1mdGL.jpg);
    background-position: center;
    background-repeat: no-repeat;
    height: 208px;
   
}

aside h1 span {
    visibility: hidden;
}
<body>
   
   <div class="columns">
      
       <aside class="column is-3">
           <h1><span>Lorem ipsum</span></h1>
           
       </aside>
                   
   </div>
    
07.08.2017 / 23:03
2

I solved it very simply as you were rendering the image the width was conflicting so just add:

aside h1{
    display: block;
    margin: 0 auto;
}

aside {
  height: 100vw;
  background-color: #fff;
  border-right: 3px solid #000;
  font-family: 'Lato', sans-serif;
  text-align: center;
  padding-top: 25px !important;
}

aside h1 {
    background-image: url("https://image.prntscr.com/image/RQ2u88wpQDmxnJNQyput-Q.png");
    background-position: center center;
    background-repeat: no-repeat;
    height: 208px;
    width: 200px;
    display: block;
    margin: 0 auto;
}

aside h1 span {
    visibility: hidden;
}
<div class="columns">
    <aside class="column is-3">
        <h1><span>Lorem ipsum</span></h1>
           
    </aside>
</div>
    
07.08.2017 / 23:19