Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 07-21-2015, 07:20 AM   #1
leescott
Junior Member
leescott began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jul 2015
Device: BOOX
fit a image to the width of screen

How to fit a image to the width of screen(mobile)?Can you give me some codes about such things.
And for diffrent screen ,image width has the least request?
Thanks for your work!
Please give me codes.
My document is epub.
leescott is offline   Reply With Quote
Old 07-21-2015, 07:48 AM   #2
leescott
Junior Member
leescott began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jul 2015
Device: BOOX
http://www.cnepub.com/discuz/thread-204859-2-1.html
I can't use it。Why?
leescott is offline   Reply With Quote
Advert
Old 07-21-2015, 08:14 AM   #3
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,094
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
Welcome to MR Forum!

You might want to try asking these types of questions in the Workshop area. This sub-forum is for Calibre specific questions.

For most book format's you could use the following:

Code:
<div class="whatever"><img alt="" src="../Images/example.jpg" /></div>

with CSS:
.whatever {width:100%; max-width:2015px} 
               *set max-width to the actual width of that image*
               *add any other styling to your preferences*
This will keep the aspect ratio and expand it to fill the <div> but will not stretch the image if the screen is too large - that prevents blurring of the image.


You could also try wrapping the image in SVG - but that is a bit more complicated and I've been told that not all devices support SVG all the time.

I hope that helps!

Last edited by Turtle91; 07-21-2015 at 08:17 AM.
Turtle91 is offline   Reply With Quote
Old 07-21-2015, 08:29 AM   #4
leescott
Junior Member
leescott began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jul 2015
Device: BOOX
Thanks for your reply!
Here's a file.http://pan.baidu.com/s/1i3F4TSx
I asked such question at here ,because I made epub using cablibre from a word file.
leescott is offline   Reply With Quote
Old 07-21-2015, 08:53 AM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,800
Karma: 54830978
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Moderator Notice
This is a generic EPUB question. It does not change because of the tool you used (Calibre) to make it. Moved
theducks is offline   Reply With Quote
Advert
Old 07-23-2015, 05:44 AM   #6
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
I use images 800 pixels wide, with the html instruction width="100%" , and have not experienced any problems that I know of.

I put that instruction inline, so that I'm not stuck with it in every case.
Notjohn is offline   Reply With Quote
Old 07-23-2015, 06:35 AM   #7
leescott
Junior Member
leescott began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jul 2015
Device: BOOX
Thanks!
I have try 800 pixels on my 7 inches mobile,next I will revise my epub.
Maybe some things is more sophisticated, as there're different reader softwares.
leescott is offline   Reply With Quote
Old 07-23-2015, 10:39 AM   #8
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,094
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
Quote:
Originally Posted by Notjohn View Post
I put that instruction inline, so that I'm not stuck with it in every case.
I hadn't thought of that - I try and keep all styling in the CSS. I usually don't work with a large number of images, so having 4-5 lines in the CSS with different max-width has been fine, but if you have a lot of images that may make it easier.

e.g.
<div class="image"><img alt="" style="max-width:9999px" src="../Images/example.jpg" /></div>

and a single CSS line:
div.image {width:100%} /* plus any other styling */
Turtle91 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing image width in the economist goios Recipes 1 04-24-2014 01:29 PM
problem with floating image and relative width jobalcaen ePub 5 08-17-2013 07:53 AM
K3 - Fit to screen (width) for PDF nuke Amazon Kindle 0 09-30-2010 09:27 AM
How to center/fit page width SVG images with <OBJECT> amoroso ePub 0 07-31-2010 11:48 AM
PRS-600 How to make prs600 display PDF fit width? wifish Sony Reader 1 12-20-2009 12:28 PM


All times are GMT -4. The time now is 09:38 PM.


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