![]() |
#1 |
Member
![]() Posts: 17
Karma: 10
Join Date: Nov 2013
Device: None
|
![]()
Hi!
Is there a problem if I use ... <p class="center"><img src="../Images/Tbl_1_1.jpg" /></p> ... for centering images? FYI, i use ... p.center {text-align: center;} ... in the style sheet. Thank you! Dr. T |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,361
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
No problem that I know of. That's typically how I go about it. Might want to make sure your img tag has an "alt" attribute, though.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17
Karma: 18298
Join Date: Jan 2015
Device: Mantano
|
The alt attribute is mandantory. If there is textual replacement for the image, leave it empty (alt="")
|
![]() |
![]() |
![]() |
#4 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,912
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
is there a plain:
p { <style stuff>; } somewhere in your CSS Your p.center class may need to be AFTER that in the sheet. ![]() |
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Also, if you have in your plain p selector text-indent, then you must also set in your center class the text-indent to zero.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,641
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
1. To use: Code:
.center { width: X%; /* Where X is the width you wish */ margin-left: auto; margin-right: auto; } Code:
<p class="center"><img alt="" src="../Images/Tbl_1_1.jpg" /></p> 2. To use: Code:
.center { text-align: center; text-indent: 0; } .inlined { display: inline; } Code:
<p class="center"><img class="inlined" alt="" src="../Images/Tbl_1_1.jpg" /></p>
Regards Rubén |
|
![]() |
![]() |
![]() |
#7 | |
Connoisseur
![]() Posts: 67
Karma: 10
Join Date: Apr 2011
Device: Kindle 3, Samsung Tab 4
|
Quote:
http://www.impressivewebs.com/defaul...html-elements/ |
|
![]() |
![]() |
![]() |
#8 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,361
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
|
|
![]() |
![]() |
![]() |
#9 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 79,181
Karma: 144286760
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
And this thread belongs in the Sigil forum and not the ePub forum because?
|
![]() |
![]() |
![]() |
#10 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,912
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
|
![]() |
![]() |
![]() |
#11 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,641
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
![]() https://www.mobileread.com/forums/sho...d.php?t=247587 |
|
![]() |
![]() |
![]() |
#12 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,361
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
So when you said; "that won't work," you really meant; "that may not work with certain buggy rendering software"?
![]() |
![]() |
![]() |
![]() |
#13 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,641
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
|
![]() |
![]() |
![]() |
#14 |
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
|
|
![]() |
![]() |
![]() |
#15 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,361
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Quote:
![]() Ruben's post led me to believe there was something inherently wrong with the code, is all. And I don't believe there is. The text-align css was properly being applied to the block e!ement 'p' (whose text will display inline). The img tag, as a block-level element that's displayed inline should be centered horizontally by any competent browser/epub renderer out there. But if one has to ensure that things display properly on the widest range of devices out there, then by all means... point out the aberant systems, and the special requirements to make them to behave properly. Last edited by DiapDealer; 01-22-2015 at 07:20 PM. |
|
![]() |
![]() |
![]() |
Tags |
centering images |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Centering images in iPad mini/iBooks/iOS8 | AlexBell | ePub | 18 | 10-26-2014 12:02 AM |
Centering images | perkin5 | Conversion | 8 | 09-19-2014 10:40 AM |
Centering Images using object styles | SamL | ePub | 7 | 04-05-2011 01:28 PM |
How to do centering | sjohnson717 | Calibre | 15 | 02-28-2010 09:20 AM |
centering images with css override? | Amalthia | Calibre | 2 | 03-30-2009 01:53 PM |