View Single Post
Old 04-10-2024, 12:05 PM   #34
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,804
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by JSWolf View Post
The eBook I mentioned and posted CSS from is simply formatted and does not need such complex code that StandardEbooks use. Also, you won't use more complex code where it's needed and not where it's not.
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:

Click image for larger version

Name:	Screenshot_2024-04-10-12-21-27.png
Views:	1049
Size:	29.9 KB
ID:	207482

and after increasing the font-size:

Click image for larger version

Name:	Screenshot_2024-04-10-12-20-46.png
Views:	1070
Size:	36.5 KB
ID:	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.

Last edited by RbnJrg; 04-10-2024 at 12:08 PM.
RbnJrg is offline   Reply With Quote