![]() |
How to stretch background image full screen?
1 Attachment(s)
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! |
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! |
Quote:
|
Quote:
|
Quote:
Code:
div.img { |
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" |
Quote:
Hitch |
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. |
4 Attachment(s)
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 {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. |
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 |
Quote:
|
| All times are GMT -4. The time now is 09:32 PM. |
Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.