View Single Post
Old 09-14-2013, 06:20 PM   #8
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,548
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by crutledge View Post
The folloeing is one stanza of a poem,

[CODE]
<div class="poem">
<div class="stanza">
<span class="i0">Mi memoria en ti se ocupa</span><br />
<span class="i0">No te olvida un solo instante,</span><br />
<span class="i0">Y mi mente delirante En ti piensa,</span><br />
<span class="i0">en ti piensa sin cesar.</span><br />
</div>
</div>
CODE]

I would like to center the poem on the page without losing the foemat. Nothing I have tried has nas workeed.


advice
Hi crutledge;

What you want, it can be done, at least in the modern .kf8 format. In your .css stylesheet write:

Code:
h2 {
   text-indent: 0;
   text-align: center;
   font-size: 1.4em;
   font-weight: bold;
   margin: 1em 0 2em;
}

.poem {
    display: table;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}

.stanza {
    display: table-cell;
    vertical-align: top;
}
And in your .html file write:

Code:
<h2>Título del Poema</h2>

  <div class="poem">
    <div class="stanza">
      Mi memoria en ti se ocupa<br />
      No te olvida un solo instante,<br />
      Y mi mente delirante En ti piensa,<br />
      en ti piensa sin cesar.
    </div>
  </div>
Below you can see screenshots of my kindle with different font-sizes and both, in portraid and landscape mode. As you can see, the body of the poem always remains centered. But since this technique makes use of the properties display: table and margin-left: auto, margin-right: auto, it doesn't work in ADE.

Regards
Rubén
Attached Thumbnails
Click image for larger version

Name:	screen_shot-9328.gif
Views:	161
Size:	6.3 KB
ID:	111043   Click image for larger version

Name:	screen_shot-9329.gif
Views:	256
Size:	9.5 KB
ID:	111044   Click image for larger version

Name:	screen_shot-9330.gif
Views:	160
Size:	6.3 KB
ID:	111045   Click image for larger version

Name:	screen_shot-9331.gif
Views:	192
Size:	11.0 KB
ID:	111046  
Attached Files
File Type: epub Centered Poem.epub (2.3 KB, 119 views)
RbnJrg is offline   Reply With Quote