|  11-07-2021, 09:05 PM | #1 | 
| Morlock            Posts: 34 Karma: 2734796 Join Date: Oct 2021 Device: Kindle Paperwhite | 
				
				A tag that's new to me <div/>
			 
			
			I've recently run across this self closing tag in a few books, but it looks like it should actually be </div> and not <div/>.  In fact the check book tool throws an error, so clearly it's not effective in closing the <div> tag. Is this to be used in some specific situation? Can you cast any light? | 
|   |   | 
|  11-07-2021, 09:16 PM | #2 | 
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | 
			
			<div/> is the same as <div></div>
		 | 
|   |   | 
| Advert | |
|  | 
|  11-12-2021, 08:36 PM | #3 | 
| Wizard            Posts: 1,090 Karma: 447222 Join Date: Jan 2009 Location: Valley Forge, PA, USA Device: Kindle Paperwhite | |
|   |   | 
|  11-12-2021, 09:53 PM | #4 | |
| Wizard            Posts: 2,306 Karma: 13057279 Join Date: Jul 2012 Device: Kobo Forma, Nook | Quote: 
 You can use CSS's ::before + ::after + content to insert stuff like images, asterisks, or have certain text be spoken out loud during Text-to-Speech: https://codersblock.com/blog/diving-...eudo-elements/ | |
|   |   | 
|  11-12-2021, 10:34 PM | #5 | |
| Wizard            Posts: 1,291 Karma: 1428263 Join Date: Dec 2016 Location: Goiânia - Brazil Device: iPad, Kindle Paperwhite, Kindle Oasis | Quote: 
 I use <div/> for separators (a line below a chapter title, for example). This is just decorative and you should not use a <hr/> tag, since it means a thematic break in HTML5. | |
|   |   | 
| Advert | |
|  | 
|  11-12-2021, 11:25 PM | #6 | 
| Running with scissors            Posts: 1,592 Karma: 14328510 Join Date: Nov 2019 Device: none | 
			
			Many tags that you see as a begin and end pair can also be given as the singular with the slash at the end.  For example, I tried all of these and none gave an error with EpubCheck. Code: <p/> <em/> <b/> <span/> <body/> Not related to this, but speaking of hr tags and combinators, in my stylesheet.css I have Code: hr + p {
  text-indent: 0;
}Last edited by hobnail; 11-12-2021 at 11:28 PM. | 
|   |   | 
|  11-12-2021, 11:37 PM | #7 | |
| creator of calibre            Posts: 45,604 Karma: 28548974 Join Date: Oct 2006 Location: Mumbai, India Device: Various | Quote: 
  In EPUB you dont have HTMl you have XHTML which is XML. In XML *any* tag can be self closing, regardless of whether it is useful or not. | |
|   |   | 
|  11-13-2021, 02:30 AM | #8 | ||
| Wizard            Posts: 2,306 Karma: 13057279 Join Date: Jul 2012 Device: Kobo Forma, Nook | Quote: 
 especially posts #128 and beyond. Me + Hitch went breaking down pros/cons of "<hr/> as scenebreaks". Personally, I just use simple, centered asterisks. Not relying on CSS3 or complicated overrides (these will fail across many older readers/devices). Side Note: The one nice thing about <hr/> in HTML5 is it generates a new <section> in the Accessibility Tree. I described some of that in post #148 of that thread. This would allow a screen reader to easily jump between scenes (or sections of an article) without the need for extra markup. Quote: 
 Like I remember running across a Sigil "bug" with: Code: <p"> Sigil would completely crash with Reports, Spellcheck Lists, etc., but other things like Preview worked fine... KevinH dug into this, and turns out, it's actually "valid" (but VERY horrible) HTML5. I convinced KevinH to match Calibre's parsing of this, by changing it into an underscore: Code: <p_> Note: EPUB2 is XHTML1.1, and EPUB3... many tools like Sigil/Calibre conform to XHTML5—accepting HTML5's new tags, but still enforcing XHTML's stricter rules... like always closing your tags and using quotes around your attributes. This is just good practice, and I have no idea why you'd NOT want to use XHTML5. Last edited by Tex2002ans; 11-13-2021 at 02:53 AM. | ||
|   |   | 
|  | 
| 
 | 
|  Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Sigil div tag issue HELP | ebookscovers | Sigil | 12 | 06-02-2021 09:48 AM | 
| Tag Mapper: Remove tag if another specific tag exists? | ownedbycats | Library Management | 2 | 07-23-2020 10:32 PM | 
| Ways for the parent tag to not be shown with the child tag in the tags column? | icecold | Calibre | 3 | 03-16-2020 10:23 PM | 
| html img tag versus svg wrapped image tag | hobnail | ePub | 8 | 02-27-2020 03:16 AM | 
| How to show books with only 1 tag? Dynamic tag or virtual library? | cd2013 | Calibre | 4 | 03-01-2019 06:41 PM |