View Single Post
Old 02-23-2015, 02:30 PM   #4
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,834
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by u238110 View Post
I'm not concerned about device compatibility. ...
In that case is perfectly possible. Use the following code:

1. In your .css stylesheet write:

Code:
html, body {
   height: 100%;
}

#container {
   display: table;
   height: 100%;
   width: 100%;
   border: 5px solid;
}

.row {
   display: table-row;
   height: 33%;
}

.cell {
   display: table-cell;
   height: 33%%;
   vertical-align: bottom;
   text-align: center;
}
2. And in your .xhtml file write:

Code:
<body>
<div id="container">
   <div class="row">
       <p class="cell">text</p>
   </div>
   <div class="row">
       <p class="cell">text</p>
   </div>
   <div class="row">
       <p class="cell">&nbsp;</p>
   </div>
</div>
</body>
This is how it looks in Sigil:

Click image for larger version

Name:	Image1.png
Views:	216
Size:	78.0 KB
ID:	135215

As you can see, I use a model of three rows and a "vertical-align: bottom". You can bring the text to the center of the screen all you want by changing the height of the rows (for example with the first and third rows with a height of 40% and the middle row with a height of 20% the text will be nearer the center). Of course, take in count that in order to use this code on ADE, you must convert the .epub I attach as epub3 and to use ADE 4 (or higher).

Regards
Rubén
Attached Files
File Type: epub Text on center.epub (2.2 KB, 206 views)
RbnJrg is offline   Reply With Quote