View Single Post
Old 08-26-2021, 05:57 PM   #5
MicroDrie
Connoisseur
MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.MicroDrie ought to be getting tired of karma fortunes by now.
 
Posts: 58
Karma: 438844
Join Date: Aug 2019
Device: PC, Linux Mint, Tablet, and Telephone
Quote:
Originally Posted by peace19812006 View Post
I am trying to use the image as background for the book. I use CSS like this:
div.img {
background-image: url(../images/4444.jpg);
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
However, the image cannot be stretched full width. See the picture below. I don't want to see white color in this image. How can I fix that? Thanks!
As Turtle91 already wrote, you <div> have a margin. By adding the same margin value negatively in your <div.img> you cancel this margin. To give the text a certain margin like 10px, put it in this new margin like this CSS command.
Code:
div.img {
  margin: -10px; /* use full width */
  background-image: url(../images/4444.jpg);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}
div.img p { 
  margin: 10px; /* Move text to original location */
}
MicroDrie is offline   Reply With Quote