Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 08-25-2021, 12:19 AM   #1
peace19812006
Junior Member
peace19812006 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Aug 2021
Device: Oasis 3
How to stretch background image full screen?

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!
Attached Thumbnails
Click image for larger version

Name:	image.jpg
Views:	192
Size:	233.8 KB
ID:	188890  
peace19812006 is offline   Reply With Quote
Old 08-25-2021, 10:22 AM   #2
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,093
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
If you are placing it in a <div> then it will only fill the div (the parent container). The div probably has some kind of margins to make it smaller than the window. If you want to fill the whole page you need to apply it to the body or html.


Welcome to MR!
Turtle91 is offline   Reply With Quote
Old 08-25-2021, 10:23 PM   #3
peace19812006
Junior Member
peace19812006 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Aug 2021
Device: Oasis 3
Quote:
Originally Posted by Turtle91 View Post
If you are placing it in a <div> then it will only fill the div (the parent container). The div probably has some kind of margins to make it smaller than the window. If you want to fill the whole page you need to apply it to the body or html.


Welcome to MR!
Thanks bro!
peace19812006 is offline   Reply With Quote
Old 08-25-2021, 10:43 PM   #4
peace19812006
Junior Member
peace19812006 began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Aug 2021
Device: Oasis 3
Quote:
Originally Posted by Turtle91 View Post
If you are placing it in a <div> then it will only fill the div (the parent container). The div probably has some kind of margins to make it smaller than the window. If you want to fill the whole page you need to apply it to the body or html.


Welcome to MR!
I tried to use it. It's okay for background-color. However, I cannot use background-image in it.
peace19812006 is offline   Reply With Quote
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
Old 08-27-2021, 01:53 AM   #6
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by peace19812006 View Post
I am trying to use the image as background for the book.

[...]

How can I fix that? Thanks!
What reader are you using/testing on?

And is this background image just for your personal usage? Or are you trying to sell this ebook?

If selling, I'd strongly recommend against any background images. They don't work reliably + cause more harm. For more details, see mine + Hitch's answers in:

2021: "Background Image w/ Text on Top"

Last edited by Tex2002ans; 08-27-2021 at 02:00 AM.
Tex2002ans is offline   Reply With Quote
Old 08-27-2021, 09:25 AM   #7
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,460
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by Tex2002ans View Post
What reader are you using/testing on?

And is this background image just for your personal usage? Or are you trying to sell this ebook?

If selling, I'd strongly recommend against any background images. They don't work reliably + cause more harm. For more details, see mine + Hitch's answers in:

2021: "Background Image w/ Text on Top"
Not to mention, but afaik, there are nearly zero devices that support full-bleed imagery in eBooks, other than (possibly) the cover. Isn't that the gist here? S/he wants full-bleed, edge-to-edge, or have I misread?

Hitch
Hitch is offline   Reply With Quote
Old 08-27-2021, 10:26 AM   #8
Quoth
the rook, bossing Never.
Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.Quoth ought to be getting tired of karma fortunes by now.
 
Quoth's Avatar
 
Posts: 11,080
Karma: 85874891
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper11
Quote:
Originally Posted by Hitch View Post
Not to mention, but afaik, there are nearly zero devices that support full-bleed imagery in eBooks, other than (possibly) the cover. Isn't that the gist here? S/he wants full-bleed, edge-to-edge, or have I misread?

Hitch
I think you are right on both counts.

And on some cases you need a per model margin with negative pixels. Backgrounds in a document rather than a "desktop" or "Home page", except on rare occasions are a disaster on anything. Terrible on web, paper, apps, programs or ebooks.
Quoth is offline   Reply With Quote
Old 08-27-2021, 12:29 PM   #9
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by Hitch View Post
Not to mention, but afaik, there are nearly zero devices that support full-bleed imagery in eBooks, other than (possibly) the cover. Isn't that the gist here? S/he wants full-bleed, edge-to-edge, or have I misread?
Hi Hitch;

On the Android world, you have Readily, Lithium and PocketBook that support zero-bleed imagery (any page, not only the cover). I'm speaking about epub3 and by adding the background image at the <html> level, something like:

Code:
html {
   background: url("../Images/bg_paper1.jpg") no-repeat center center;
   background-size: cover;
   height: 100vh;
   margin: 0;
   padding: 0;
}

body {
/* This declaration shouldn't be neccesary except by PocketBook */
   background-color: transparent; 
}
The plugin BibiReader for Sigil, also can show background images with zero bleed. Here you can watch some screenshots (one and two pages view), with a background image that mimics an old paper (as I said, also is possible to get the same result with Readily, Lithium and PocketBook):

Click image for larger version

Name:	Image1.png
Views:	227
Size:	676.2 KB
ID:	188948 Click image for larger version

Name:	Image2.png
Views:	246
Size:	360.0 KB
ID:	188949 Click image for larger version

Name:	Image3.png
Views:	239
Size:	310.5 KB
ID:	188950

But one thing is that it is possible to include a background image (with many limitations) and another thing is that it is a good idea. I would never include such kind of images.
Attached Files
File Type: epub Background Images - Zero Bleed_epub3.epub (57.5 KB, 147 views)

Last edited by RbnJrg; 08-27-2021 at 12:33 PM.
RbnJrg is offline   Reply With Quote
Old 08-27-2021, 12:46 PM   #10
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
Posts: 11,460
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
Quote:
Originally Posted by RbnJrg View Post
Hi Hitch;

On the Android world, you have Readily, Lithium and PocketBook that support zero-bleed imagery (any page, not only the cover). I'm speaking about epub3 and by adding the background image at the <html> level, something like:

Code:
html {
   background: url("../Images/bg_paper1.jpg") no-repeat center center;
   background-size: cover;
   height: 100vh;
   margin: 0;
   padding: 0;
}

body {
/* This declaration shouldn't be neccesary except by PocketBook */
   background-color: transparent; 
}
The plugin BibiReader for Sigil, also can show background images with zero bleed. Here you can watch some screenshots (one and two pages view), with a background image that mimics an old paper (as I said, also is possible to get the same result with Readily, Lithium and PocketBook):

Attachment 188948 Attachment 188949 Attachment 188950

But one thing is that it is possible to include a background image (with many limitations) and another thing is that it is a good idea. I would never include such kind of images.
Yes, but Ruben:

You're talking browser- or desktop-software based readers. I'm talking DEVICES. (Kindles, Fires, Nooks, Kobos, and the like.) And as far as I know...full-bleed really isn't supported on the major (or minor) devices.

I'm not arguing that some effects are lovely--they are. But for the poster's purposes, I tend to assume that s/he is trying to use the coding for commercial purposes.

Hitch
Hitch is offline   Reply With Quote
Old 08-27-2021, 01:43 PM   #11
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by Hitch View Post
I'm talking DEVICES. (Kindles, Fires, Nooks, Kobos, and the like.) And as far as I know...full-bleed really isn't supported on the major (or minor) devices.
No, so far I don't know any device that has support for display images (except for covers) without bleed. Just apps, and so far, only *THREE*. Maybe in a future we'll be able to think of an e-ink reader with such feature.
RbnJrg is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stretch the cover to fit the screen? ZodWallop Kobo Reader 23 06-30-2018 09:17 AM
svg image on top of a background png image roger64 ePub 25 04-24-2015 11:00 AM
background-image Hermann14 Software 1 02-17-2015 03:38 AM
What's a good, free program to stretch an image? Dr. Drib Writers' Corner 10 12-13-2014 10:27 AM
Stretch Cover Image, Internal links _savage Calibre 7 07-20-2012 12:00 AM


All times are GMT -4. The time now is 12:59 AM.


MobileRead.com is a privately owned, operated and funded community.