4
I avoided asking anyone for help for my own learning. But of all the difficulties that I have been facing this cannot solve and is the last stage of the project.
I need to insert a mobile image in the center of the screen. So far everything right. Searching found solutions to leave the image responsive. The problem is that the image gets the scroll bar active at smaller resolutions. How do I resize the image and avoid scrolling?
Follow the code I have so far.
<style type="text/css">
body{
background: #363636;
}
.backgroundCell{
width: 100%;
height: auto;
}
.backgroundCell img{
max-width: 556px; /* Máximo da largura da imagem */
width: 100%;
max-height: 1139px; /* Máximo da altura da imagem */
min-height: auto; /* Mínimo da altura, por padrão “auto” */
background-size: 100%;
background-repeat: no-repeat;
}
</style>
<div class="main-panel">
<div class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<center>
<div class="backgroundCell">
<img src='assets/img/iphone_bg.png' />
</div>
</center>
</div>
</div>
</div>
</div>
</div>
By the way you’re wearing
bootstrap
, then you can apply in the image the classimg-responsive
. Also, just addoverflow: hidden
image to not display scrollbars.– Ricardo Pontual
Yes @Ricardopunctual, I’m using bootstrap. I’ve tried with this class, it didn’t help much. I have tried with the class mentioned and also with the overflow. The problem continues. The scroll continues to be displayed. I think the problem really is the size of the image, because when you roll it, the rest of the image appears.
– Y. Mths
So the scroll bar is in the image container, which can be any of the Divs that contains it, the div with class "backgroundCell" for example. Tried to put the
overflow: hidden
in that div?– Ricardo Pontual
The scroll was in the main-panel div. I was testing one by one until I found it. Now the image is cropped.
– Y. Mths