Home > Back-end >  how do i remove the extra white space in my website
how do i remove the extra white space in my website

Time:08-09

On my website, it keeps adding extra white space on the right side

I can't figure out how to remove it, I tried the margin padding, and it didn't work
if it's a problem with my code, then here is the code for the images and styles

div.box {
  display: block;
  margin-left: -1250px;
  margin-top: -225px;
}


/* applied for all images, e.g box2, box3, box4*/
<div >
  <img src="https://i.pinimg.com/736x/76/d8/03/76d80307e603191188e9e7faac52bed3.jpg" alt="cute cat">
</div>

CodePudding user response:

Use the overflow css property:

div.ex1 {
  overflow: scroll;
}

div.ex2 {
  overflow: hidden;
}

div.ex3 {
  overflow: auto;
}

div.ex4 {
  overflow: clip;
}

div.ex5 {
  overflow: visible;
}

CodePudding user response:

you can simply use padding & margin property.


.box {
  padding: 0;
  width: fit-content;
  height: fit-content;
}

.box img {
  margin: 0;
}
<div >
  <img src="https://i.pinimg.com/736x/76/d8/03/76d80307e603191188e9e7faac52bed3.jpg" alt="cute cat">
</div>

CodePudding user response:

add padding to your code.

div.box {
  padding:0;
  ...
}
div.box img{
   padding:0;
   margin:0;
}

CodePudding user response:

try writing some css for image , to make a image responsive we use

img {width : 100%;}

this will tell image to take full width of div..

  • Related