|  07-17-2020, 01:47 PM | #1 | 
| Member  Posts: 14 Karma: 10 Join Date: Jun 2020 Device: Kindle |  Image Display Size Help 
			
			I'm still fairly new at this so please be patient. I'm trying to display a small image (ne-logo.png) and resize it 50% using CSS in the stylesheet. But whatever I change on the CSS makes no difference! Please tell me where I'm going wrong. The image is 100px square at 72dpi. HTML: Code: <span class=“s3”><img src="images/ne-logo100.png" alt="ne-logo100.png" class=“s2”/></span></img> Code: .s2 { /* NE LOGO */
  height: 50%;
  width: 50%
}
.s3 { /* NE LOGO */
  display: inline-block;
  vertical-align: baseline;
  width: 1.336em;
  margin-left: 0%;
  margin-top: 2%;
  padding-top: 2%;
  margin-right: 0;
  margin-bottom: 0%;
  text-indent: 0;
  max-width: 50%;
  width: 100.000%;
} | 
|   |   | 
|  07-17-2020, 02:12 PM | #2 | 
| Grand Sorcerer            Posts: 7,159 Karma: 92500001 Join Date: Nov 2011 Location: Charlottesville, VA Device: Kindles | 
			
			You want the width to be 50% of what? The screen width? Hopefully your actual HTML file uses straight quotes instead of the curly ones in your sample. Your s3 class has conflicting width properties. | 
|   |   | 
| Advert | |
|  | 
|  07-17-2020, 02:33 PM | #3 | 
| A Hairy Wizard            Posts: 3,395 Karma: 20212733 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 | 
			
			try this: Code: div.image {margin:2em auto}
div.image img {width:50%; max-width:100px}
<div class="image"><img alt="" src="images/ne-logo100.png"/></div>Last edited by Turtle91; 07-18-2020 at 07:56 AM. Reason: Clarification of purpose for 'max-width' | 
|   |   | 
|  07-17-2020, 03:45 PM | #4 | 
| frumious Bandersnatch            Posts: 7,570 Karma: 20150435 Join Date: Jan 2008 Location: Spaniard in Sweden Device: Cybook Orizon, Kobo Aura | |
|   |   | 
|  07-17-2020, 04:08 PM | #5 | 
| Resident Curmudgeon            Posts: 80,740 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | 
			
			Do you realize that your square is going to look very very small on a 300DPI Kindle?
		 | 
|   |   | 
| Advert | |
|  | 
|  07-17-2020, 09:16 PM | #6 | 
| A Hairy Wizard            Posts: 3,395 Karma: 20212733 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 | 
			
			You are, of course, technically correct. However, in the eBook realm - with the current bevy of hardware and software - it is practically the same thing. Do you know of a different technique to prevent blowing out small images - I'd be happy to use something that works better??
		 | 
|   |   | 
|  07-18-2020, 04:09 AM | #7 | 
| Member  Posts: 14 Karma: 10 Join Date: Jun 2020 Device: Kindle | 
			
			OK, now I'm getting more confused. All I'm trying to do is get a logo to appear on the title page of my book, centered on the page below the author name. It needs to appear about a half inch square on any device, whether it's a Paperwhite or a Kindle Fire.  Should I have more than one version? or use CSS to display it at varying sizes for each screen?? | 
|   |   | 
|  07-18-2020, 06:44 AM | #8 | |
| frumious Bandersnatch            Posts: 7,570 Karma: 20150435 Join Date: Jan 2008 Location: Spaniard in Sweden Device: Cybook Orizon, Kobo Aura | Quote: 
 By the way, I believe that a "px" is, in compliant devices, guaranteed to be an integer number of actual pixels, so at least the image should look fine. Still, you need to know the pixel size of the image. | |
|   |   | 
|  07-18-2020, 06:45 AM | #9 | 
| frumious Bandersnatch            Posts: 7,570 Karma: 20150435 Join Date: Jan 2008 Location: Spaniard in Sweden Device: Cybook Orizon, Kobo Aura | |
|   |   | 
|  07-18-2020, 08:16 AM | #10 | |
| Resident Curmudgeon            Posts: 80,740 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | Quote: 
 | |
|   |   | 
|  07-18-2020, 08:18 AM | #11 | 
| Resident Curmudgeon            Posts: 80,740 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | |
|   |   | 
|  07-18-2020, 08:39 AM | #12 | 
| frumious Bandersnatch            Posts: 7,570 Karma: 20150435 Join Date: Jan 2008 Location: Spaniard in Sweden Device: Cybook Orizon, Kobo Aura | 
			
			That is wrong with the OP's requirement, not with the code that does what he/she wants.
		 | 
|   |   | 
|  07-18-2020, 10:33 AM | #13 | |
| A Hairy Wizard            Posts: 3,395 Karma: 20212733 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 | Quote: 
 The problem is the resolution of the screen. A high resolution screen (@500 PPI Pixel density) will make the image (at 100 pixels wide) blown out - it's stretching the 100 pixels to fill 250 pixels (.5 x 500). That's why it is always better to have as high a resolution image as is feasible. Most devices/apps do a pretty good job compressing an image...not so much expanding one that is too small. For the OP: Most people would want the image to be relative to the rest of the document/font/screen size...it looks awfully funny to have an out of proportion image. That's why my previous example had a percentage with a limit on how big it gets. However, if you want the image to be .5 inch wide (because, presumably, you are stuck in the paper print paradigm  ), then use width=.5in....but I would get a higher resolution image, 250-300 pixels square. Code: div.image {margin:2em auto; width:.5in}
<div class="image"><img alt="" src="images/ne-logo100.png"/></div> | |
|   |   | 
|  07-19-2020, 04:30 PM | #14 | 
| mostly an observer            Posts: 1,519 Karma: 996810 Join Date: Dec 2012 Device: Kindle | 
			
			I have precisely the same wish, and no desire to get into media calls, so I upload a colophon 100 pixels square with a width=10%. It's a bit oversized on the very early Kindles, which ignore the 10% instruction, but not objectionably so, and looks fine on the current Paperwhite and the Fire tablet.
		 | 
|   |   | 
|  07-19-2020, 04:35 PM | #15 | |
| Resident Curmudgeon            Posts: 80,740 Karma: 150249619 Join Date: Nov 2006 Location: Roslindale, Massachusetts Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 | Quote: 
 | |
|   |   | 
|  | 
| Tags | 
| css, image, resize | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| paste cover image changes image's size | pipistrelosone | Editor | 1 | 10-07-2016 09:10 AM | 
| Image size | JSWolf | Feedback | 19 | 11-13-2015 05:16 AM | 
| Image size. | UncleIvor | ePub | 13 | 04-04-2015 04:15 AM | 
| Display of a png image linked to a svg image | roger64 | Editor | 6 | 03-13-2015 06:21 AM | 
| Image Size | benjaminsolah | ePub | 13 | 09-24-2010 11:47 PM |