![]() |
#1 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Image within a title: how to align?
Hi
It's a h title. For the time being, the image tag is within (maybe someone has a better solution). I'd like to find a display that lower the Q on the joint image so as to fit the text of the title. I'm short on ideas (not an unusual situation ![]() Last edited by roger64; 05-08-2014 at 01:08 AM. |
![]() |
![]() |
![]() |
#2 | |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 398
Karma: 96448
Join Date: Dec 2013
Device: iPad
|
Crop your image to have no white space at the bottom or right side, preferably on top and left sides as well, put the image tag before the text inside the <h> tags and give it a style of display:inline
e.g.: Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,548
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
If you want to align the baselines of text and image, that's going to be tricky. I think I tried with "position:relative;bottom:-x", but it didn't work with inline elements (and besides, finding the right value for x would be mostly trial and error). It may be easier if both image and text are in an SVG wrapper. Something I didn't try is putting only the image in an SVG wrapper, such that it "overflows" the viewbox...
|
![]() |
![]() |
![]() |
#4 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,762
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#5 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
hi
Thanks for your replies. Here is the image. It's an old book so the quality is just so-so and it hardly could be made an SVG. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80
Karma: 1184732
Join Date: Nov 2013
Device: Kobo Glo
|
vertical-align property, within the image tag.
http://www.w3schools.com/cssref/pr_p...ical-align.asp |
![]() |
![]() |
![]() |
#7 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Thank you. It's very easy this way with this code (seen with Calibre viewer):
Code:
<h2 id="toc1"><img alt="Image" src="../img-4.png" style="width:10%; vertical-align:-0.5em;"/>uelques mots…</h2> |
![]() |
![]() |
![]() |
#8 |
eBook Enthusiast
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 85,544
Karma: 93383099
Join Date: Nov 2006
Location: UK
Device: Kindle Oasis 2, iPad Pro 10.5", iPhone 6
|
Surely you want your "alt" property to have the text "Q", don't you, not the word "Image"?
|
![]() |
![]() |
![]() |
#9 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,548
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
![]() |
![]() |
![]() |
#10 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,762
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
I found three methods to get what you want and all of them work in ADE ![]() In the .css stylesheet I have: Code:
h1 { font-size: 1.6em; } .base { width: 100px; height: auto; } .method1 { vertical-align: -15px; /* VERTICAL ALIGN METHOD */ } .method2 { margin-bottom: -15px; /* MARGIN-BOTTOM METHOD */ } .method3 { float: left; /* FLOAT METHOD */ } .down1 { margin-top: 92px; } Code:
<h1><img alt="Q" class="base method1" src="../Images/Q.png" />uod erat demonstrandum - Method 1</h1> <h1><img alt="Q" class="base method2" src="../Images/Q.png" />uod erat demonstrandum - Method 2</h1> <p><img alt="Q" class="base method3" src="../Images/Q.png" /></p> <h1 class="down1">uod erat demonstrandum - Method 3</h1> It works with ANY ADE FONT SIZE ![]() Regards Rubén Last edited by RbnJrg; 05-08-2014 at 12:45 PM. |
|
![]() |
![]() |
![]() |
#11 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,624
Karma: 3120635
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
|
Hi
Thank you all for your comments and your kind help. I've settled on the "vertical-align" method but others methods are indeed very OK too. I will dutifully replace "image" in the Alt field with "Q", and express everything in em. |
![]() |
![]() |
![]() |
#12 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80
Karma: 1184732
Join Date: Nov 2013
Device: Kobo Glo
|
Since the image has fixed dimensions, and considering what you want is adjusting the baseline of the Q image, you are better off using px not em for the image style. The dimension of your image is not em dependent.
Consider also additionnal styling in the case the image can't be rendered (and the alt text "Q" is used instead). You might want the "Q" text to be stylised more or less similarly to the image. I'm not sure it is useful to set a width to the image? Or am I wrong and your image has a variable size and that's your aim? |
![]() |
![]() |
![]() |
#13 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,762
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
I'm not sure that expressing all in "em" is the best choice in this case. As you could see, in my solutions I used "px" with image size and "px" with vertical-align, margin-bottom and float methods. In your solution, you expressed the image size as percentage (in this case, 10%). But doing of that way, the image size will be always 10% of the "screen width" (no matter the font-size) meanwhile the text, expressed in "em" will vary and I'm not sure that the "bottom align" will remain. |
|
![]() |
![]() |
![]() |
#14 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,762
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Exactly! For that reason I used "px" in my aproximations.
|
![]() |
![]() |
![]() |
#15 |
frumious Bandersnatch
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,548
Karma: 19500001
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Joining image and title | roger64 | ePub | 11 | 12-03-2012 11:27 AM |
Centered but left align? | mtrahan | ePub | 15 | 04-01-2012 03:56 PM |
need help on how to align a table to the right | NASCARaddicted | ePub | 6 | 02-18-2011 01:46 PM |
I can not align the text...help please! XD | derfel_spain | ePub | 17 | 12-18-2010 09:45 AM |
Justify align in RTF? | griffbrad | Sony Reader | 6 | 11-27-2006 03:25 PM |