View Single Post
Old 04-10-2024, 01:45 PM   #36
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,576
Karma: 129670952
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by RbnJrg View Post
Yes, I can understand that, we are not going to kill a mosquito with a cannon. But even ebooks that are simply formatted, we can use advanced code with advantage. I give you an example, look at these pictures:

Attachment 207482

and after increasing the font-size:

Attachment 207483

Those pictures are taken from Kobo for Android. And they represent layouts very common. How do you code that in a simpler way? One line of text at top, one line at bottom and a perfect centered line (and the layout is retained no matter the font size). The simpler code is:

1) In the xhtml:
Code:
  <div class="block">
    <p>Line One</p>

    <p>Line Two</p>

    <p>Line Three</p>
  </div>
Simpler than that?

2) In the .css:
Code:
p {
   margin: 0;
}

.block {
   display: flex;
   flex-flow: column nowrap;
   justify-content: space-between;
   align-content: center;
   align-items: center;
   height: 99vh;
   border: 2px solid red;
   margin: 0;
}

.block p:nth-child(2n+1) {
   padding: 5% 0;
}

.block p:nth-child(2) {
   font-size: 2em;
   font-weight: bold;
}
With css2 properties you never can get the same perfect output. Even for simple layouts, you can use "advanced" (is not advanced at all) code to get optimal results.
It doesn't work correctly in Thorium Reader for Windows.
JSWolf is offline   Reply With Quote