![]() |
#1 |
Junior Member
![]() 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! |
![]() |
![]() |
![]() |
#2 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,312
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/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! |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Aug 2021
Device: Oasis 3
|
Thanks bro!
|
![]() |
![]() |
![]() |
#4 |
Junior Member
![]() Posts: 3
Karma: 10
Join Date: Aug 2021
Device: Oasis 3
|
I tried to use it. It's okay for background-color. However, I cannot use background-image in it.
|
![]() |
![]() |
![]() |
#5 | |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 58
Karma: 438844
Join Date: Aug 2019
Device: PC, Linux Mint, Tablet, and Telephone
|
Quote:
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 */ } |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#7 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Hitch |
|
![]() |
![]() |
![]() |
#8 | |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,698
Karma: 103837201
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
Quote:
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. |
|
![]() |
![]() |
![]() |
#9 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,641
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
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; } 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. Last edited by RbnJrg; 08-27-2021 at 12:33 PM. |
|
![]() |
![]() |
![]() |
#10 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
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 |
|
![]() |
![]() |
![]() |
#11 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,641
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
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.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Stretch the cover to fit the screen? | ZodWallop | Kobo Reader | 24 | 04-21-2025 03:35 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 |