09-25-2024, 01:34 AM | #1 |
Junior Member
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 |
09-25-2024, 01:51 AM | #2 | |||
Wizard
Posts: 1,361
Karma: 6794938
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Quote:
Quote:
Quote:
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 |
|||
Advert | |
|
09-25-2024, 02:37 AM | #3 |
Sigil Developer
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. |
09-25-2024, 02:59 AM | #4 |
Wizard
Posts: 1,361
Karma: 6794938
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
|
09-25-2024, 12:12 PM | #5 |
Junior Member
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 |
Advert | |
|
|
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 |