Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 09-25-2024, 01:34 AM   #1
goderic
Junior Member
goderic began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Sep 2024
Device: none
Using <p> instead of <div>

I am fairly familiar with HTML but only looking into epub format tonight.

I started a book in Kindle Create which produced some problematic code and I have switched over to Sigil to clean it up.

I noticed two things right away.

First, every single content block had it's own class and id and every chapter had it's own style sheet. I am not sure if that is just an artifact of Kindle create or is something set by the epub format.

I created a single style sheet with styles used throughout the book and streamlined all those redundant classes. Hope that won't cause any problems... would it?

Second, simple paragraphs seem to use <div class="class-01"> instead of a simple <p> tag. Is there a reason for that, or could I just use <p>?

I tried googling the answer but just got a lot of unhelpful results.

Thank you so much
goderic is offline   Reply With Quote
Old 09-25-2024, 01:51 AM   #2
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,361
Karma: 6794938
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Quote:
Originally Posted by goderic View Post
First, every single content block had it's own class and id and every chapter had it's own style sheet. I am not sure if that is just an artifact of Kindle create or is something set by the epub format.
That seems an overkill and poor design to have a new class and id for every block and stylesheet for every chapter.

Quote:
Originally Posted by goderic View Post
I created a single style sheet with styles used throughout the book and streamlined all those redundant classes. Hope that won't cause any problems... would it?
It is the better way to do it, and won't cause any problems if done right.

Quote:
Originally Posted by goderic View Post
Second, simple paragraphs seem to use <div class="class-01"> instead of a simple <p> tag. Is there a reason for that, or could I just use <p>?
Just use the <p> tag. My css code for the <p> tag is ...
p {
display: block;
margin-top: 0;
margin-bottom: 0;
text-indent: 1em;
}

You will soon discover
1. many epub editors may not have a complete understanding of the coding process, and try to compensate by adding redundant code. I prefer simple and clean code.

2. ereaders are not built the same, and what may work on one ereader may not work on another ereader or app.

If you are just starting off, these sites may be useful to you...
https://developer.mozilla.org/en-US/...ng-punctuation
https://www.w3schools.com/css/default.asp
Karellen is offline   Reply With Quote
Advert
Old 09-25-2024, 02:37 AM   #3
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,160
Karma: 5450818
Join Date: Nov 2009
Device: many
Except for fixed layout epubs. Then each block will have their own class (with position info) and each chapter would get its own stylesheet (typically).

Last edited by KevinH; 09-25-2024 at 10:38 AM.
KevinH is online now   Reply With Quote
Old 09-25-2024, 02:59 AM   #4
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,361
Karma: 6794938
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Quote:
Originally Posted by KevinH View Post
Except for epub fixed layout epubs.
Oh, right.
I've never worked with fixed layout, so have no idea of their requirements.
Thanks.
Karellen is offline   Reply With Quote
Old 09-25-2024, 12:12 PM   #5
goderic
Junior Member
goderic began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Sep 2024
Device: none
That is very helpful, @Karellen. Thank you as well, @KevinH

I will continue to clean up the code from and structure it more like a simple webpage.

I am building this ebook for a Kindle submission — reflowable, not print replica. Does that make any difference?

Thank you so much
goderic is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A tag that's new to me <div/> DyckBook Editor 7 11-13-2021 03:30 AM
<div> problem alheva Marvin 30 08-23-2016 10:13 PM
Image height in div soparch ePub 5 03-29-2012 02:18 PM
duplicate div id's thiefwriter ePub 6 09-17-2011 12:00 PM
Center a div marcelo2605 ePub 4 05-13-2011 08:39 AM


All times are GMT -4. The time now is 07:34 PM.


MobileRead.com is a privately owned, operated and funded community.