![]() |
#1 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 563
Karma: 403106
Join Date: Aug 2014
Device: PRS-T1
|
Auto-resize according to text
I need to format a space like a postnote, with a solid margin (visible) that has some words scattered accross - I solved this with pre.
I thought of blockquote initially, but the same problem I have with all tags: the right margin is settable starting from the right, whereas I would like to have it set, dynamically (according to font size) by ther text. The only other solution I figured out (so far only theoretically) would be to use SVG. Or is it any trick to use regular tags and params? Thanks PS: oh, ePub 2.0.1. not 3. |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,631
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Sorry but I don't understand you very well. Are you saying us that you are seeking a right margin that changes with the font-size? If so, you only need to set that margin in "em"; ie. "margin-right: 2em" (or whatever).
Last edited by RbnJrg; 08-03-2018 at 01:10 PM. |
![]() |
![]() |
![]() |
#3 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 563
Karma: 403106
Join Date: Aug 2014
Device: PRS-T1
|
I know this, and it's not what I am looking for, since the margin measures from the right to the left (that is the margin is set 2em from the right).
I will use most probably a SVG. Maybe this image helps: setting the margin to em does the first image, with the text in red. I want the other situation, depicted with 2 font sizes - the box resizes according to the text. |
![]() |
![]() |
![]() |
#4 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,631
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Ok, now I understand. You want something like a "flex-box" but working in epub 2 and with css2. For that, you can use a "table" with only one cell or <p> or <div> tags but with the property "display: inline-block". I attach an epub with examples about how to do that and below you can see a screenshot of ADE:
Of course, you can play with "widths", "margins" and "paddings". Regards Rubén EDIT: Althought in the epub I think the thing is clear, if you are going to use a table, then the table musn't have any width, so it will resize with the text. On the other hand, with <p> or <div> tags you can use the property "width" since the key here is to use the property "display: inline-block;". Last edited by RbnJrg; 08-06-2018 at 03:15 PM. |
![]() |
![]() |
![]() |
#5 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 563
Karma: 403106
Join Date: Aug 2014
Device: PRS-T1
|
Thanks,
I also thought of a table but in the end I added the display:inline-block to the pre tag and it worked, too. I checked another version of the same, and it was also based on tables and used as filling space. BTW, your example, while not doing what I need (it reflows the text inside, which I absolutely do not want), remembered me the inline-block trick which I forgot about. |
![]() |
![]() |
![]() |
#6 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,631
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#7 |
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 563
Karma: 403106
Join Date: Aug 2014
Device: PRS-T1
|
Sorry for being unclear, but I thought that this would be implicit - if one sets the right margin accoring to the text means no reflowing, otherwise the margin sets the text
![]() ![]() It doesn't matter, I managed it and it works in a few readers I have. |
![]() |
![]() |
![]() |
Tags |
automatic, epub 2, position |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question about auto splitting large text file | thekha | Sigil | 2 | 05-17-2016 02:28 AM |
Why links are not auto-hyphenating when resize | Dragan Tanevski | Sigil | 12 | 07-07-2015 07:30 AM |
PDF to Mobi - can't resize text on kindle | ernesto50 | Conversion | 2 | 11-03-2011 10:20 AM |
JPGS. auto-resize? | Satrac | Sony Reader | 3 | 07-07-2007 07:27 AM |