| 
			
			 | 
		#1 | |
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 793 
				Karma: 1538394 
				Join Date: Sep 2013 
				
				
				
				Device: Kobo Sage 
				
				
				 | 
	
	
	
		
		
			
			 
				
				Poetry Classes:  Blockquote vs Div?
			 
			
			
			I found Jellby's snippet of CSS for poetry: 
		
	
		
		
		
		
		
		
		
		
		
		
	
	https://www.mobileread.com/forums/sh...32&postcount=4 But, since it's 13 years old, I felt pretty silly trying to ask about it there. So... Quote: 
	
  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | |
| 
			
			
			
			 Addict 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 324 
				Karma: 3200000 
				Join Date: Oct 2015 
				Location: Madison, WI 
				
				
				Device: Kindle 5th Gen 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#3 | 
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 793 
				Karma: 1538394 
				Join Date: Sep 2013 
				
				
				
				Device: Kobo Sage 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Yes.  Almost invariably in what I do, this would be for snippets of poetry quoted as supporting flavors in a book.  Things like an epigraph or the starts of chapters.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 Addict 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 324 
				Karma: 3200000 
				Join Date: Oct 2015 
				Location: Madison, WI 
				
				
				Device: Kindle 5th Gen 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Yeah, I always do those as blockquotes. Like you it starts to feel like a lot of blockquoting after a while but I personally wouldn’t switch to divs or anything for that. Seems like a downgrade.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#5 | 
| 
			
			
			
			 A Hairy Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,397 
				Karma: 20212733 
				Join Date: Dec 2012 
				Location: Charleston, SC today 
				
				
				Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			blockquotes and divs can be styled to look identical - the difference is almost pure semantics. The only big difference is that you can set the "cite" attribute within the blockquote tag, divs you don't. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	If you change the css from Jelby's example above to this it will look identical. Code: 
	blockquote.poetry {
  margin: 1em 0 1em 2em;
}
blockquote.poetry p {
  margin: 0;
  padding-left: 3em;
  text-indent: -3em;
  text-align: left;
}
blockquote.poetry p.indented {
  margin-left: 2em;
}
blockquote.poetry p.first {
  margin-top: 1em;
}
 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| Advert | |
| 
         | 
    
| 
			
			 | 
		#6 | 
| 
			
			
			
			 Fanatic 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 531 
				Karma: 2268308 
				Join Date: Nov 2015 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			blockquotes are indented by default, divs are not, so blockquote is the reasonable choice.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#7 | 
| 
			
			
			
			 Resident Curmudgeon 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,782 
				Karma: 150249619 
				Join Date: Nov 2006 
				Location: Roslindale, Massachusetts 
				
				
				Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			One thing, don't use the margin shorthand. Use the separate margin lines such as margin-top: margin-right:. It's a lot easier to read the CSS that way. 
		
	
		
		
		
		
		
		
		
		
		
		
		
			As for div.poetry p, 3em is too large. Think of reading this on a small cell phone screen. You already have a 2em margin. 1em is better. Also, you don't need padding and you don't need left align. Code: 
	blockquote.poetry {
  margin-top: 1em;
  margin-right: 0;
  margin-bottom: 1em;
  margin-left: 2em;
}
blockquote.poetry p {
  margin-top: 0;
  margin-right: 0;
  margin-bottom: 0;
  margin-left: 1.5em;
  text-indent: -1.5em;
}
blockquote.poetry p.indented {
  margin-left: 2em;
}
blockquote.poetry p.first {
  margin-top: 1em;
}
Last edited by JSWolf; 07-29-2022 at 05:40 AM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#8 | |
| 
			
			
			
			 A Hairy Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,397 
				Karma: 20212733 
				Join Date: Dec 2012 
				Location: Charleston, SC today 
				
				
				Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 1. You should not make choices of html tags based on the way it looks, but by what the tag is meant to define: Use a <p> to define a paragraph Use a <table> to define a table Use a <blockquote> to define a long quote Use a <div> to define a section of html that should be treated separately from surrounding html. Etc. Technically you could use a <div> to define EVERYTHING in your html but it would not be semantically correct. Devices/apps may not function correctly if they can’t distinguish the <tags> properly. 2. Never rely on some “default” behavior - always explicitly define the presentation you want to see in your attached css stylesheet. It’s difficult to find devices/apps that consistently follow the published standards let alone some nebulous, undefined, “default”. You need to define how much of an indent you want, does that indent apply to just the first line or the whole section, does the indent vary when the user changes the font size or is it a fixed distance, is the indent measured from the parent container’s border or is it from the edge of the screen. Last edited by Turtle91; 07-29-2022 at 07:59 AM.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#9 | 
| 
			
			
			
			 Still reading 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 15,004 
				Karma: 111111255 
				Join Date: Jun 2017 
				Location: Ireland 
				
				
				Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Also if you only want to edit in MS Word or LO Writer you might have less divs and certainly with LO Writer and perfectly formatted poetry and lyrics I never ever see blockquote generated. Just <p class="somestyle" 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Also if you use ePub to proof read in the edit cycle you absolutely don't want to ever edit the HTML and CSS, except maybe for the "publish version" and I can't remember ever having to edit more than some CSS for the styles of images in maybe the last 6 years. Good advice on "Never rely on some 'default' behaviour". So when I use a list format/style in LO Writer the bullets or auto increment (letters, numbers or Roman) are explicitly typed in. No doubt the "auto" feature saves time renumbering items when you go back and insert and extra, but it creates compatibility issues and isn't worth it. Similarly we don't auto number chapter headings. Of course tables are tricky on ereaders on smaller screens or user selecting a large font. Can be tricky on Web on Mobile even with a "responsive" theme, which no doubt is why historically WordPress had no tables, you added a plug-in.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#10 | |
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 793 
				Karma: 1538394 
				Join Date: Sep 2013 
				
				
				
				Device: Kobo Sage 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 I also decided to set up div classes for poems, songs and letters. I'll use blockquotes for more generic blocks of quotes (<-   )
		 | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#11 | 
| 
			
			
			
			 Resident Curmudgeon 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,782 
				Karma: 150249619 
				Join Date: Nov 2006 
				Location: Roslindale, Massachusetts 
				
				
				Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Speaking of padding, padding is best used in a section break if you plan on using blank space. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	[code].sectionbreak { padding-top: 2em; text-indent: 0; }[/quote] The reason for this is the margin gets lost when it's at the bottom/top of the screen. The padding does not get lost.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#12 | 
| 
			
			
			
			 frumious Bandersnatch 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,570 
				Karma: 20150435 
				Join Date: Jan 2008 
				Location: Spaniard in Sweden 
				
				
				Device: Cybook Orizon, Kobo Aura 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			One difference between blockquote and div is that a blockquote cannot (if you want to comply with the standard[*], anyway) contain inline elements as direct children, it can only contain block-level elements. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	So this is wrong: Code: 
	<blockquote>Foo</blockquote> Code: 
	<div>Foo</div>  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#13 | ||
| 
			
			
			
			 frumious Bandersnatch 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,570 
				Karma: 20150435 
				Join Date: Jan 2008 
				Location: Spaniard in Sweden 
				
				
				Device: Cybook Orizon, Kobo Aura 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Quote: 
	
  | 
||
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#14 | 
| 
			
			
			
			 frumious Bandersnatch 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,570 
				Karma: 20150435 
				Join Date: Jan 2008 
				Location: Spaniard in Sweden 
				
				
				Device: Cybook Orizon, Kobo Aura 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			By the way, I no longer use <p> for each line, I use just another <div> or <div class="line">, verse lines are not paragraphs.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#15 | 
| 
			
			
			
			 Running with scissors 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,592 
				Karma: 14328510 
				Join Date: Nov 2019 
				
				
				
				Device: none 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			If you're like me the word block in the blockquote's name may make you feel like it's the correct thing to use for things like poetry, letters, etc.  But as Turtle91 points out, the blockquote has a cite attribute, so a blockquote is meant for quoting something from a larger work.  If you read the w3c's definition for blockquote they're quite firm about it being only for quoting something, not just a general purpose block of text that's visually set off from the surrounding text.  If it wouldn't make sense to use the cite attribute when you use a blockquote then you're likely semantically correct to instead use a div. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	I made the switch to div when Jellby or TeX pointed out that using blockquote for general blocks of text is incorrect. This is when I came up with the idea of using two classes; e.g., <div class="block poem">. Anyhow, I bring this up in case you'd prefer to be semantically correct with your html.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
            
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Pseudo classes to be deleted as unused classes | Leonatus | Sigil | 2 | 09-23-2018 10:12 AM | 
| Setting first line of a blockquote or div | AlexBell | ePub | 2 | 06-19-2016 09:21 AM | 
| Pseudo classes with classes | Macsurfcat | ePub | 4 | 01-07-2016 05:00 AM | 
| Div Selectors vs Paragraph Classes -- Robustness? | GrannyGrump | ePub | 14 | 10-08-2013 09:49 AM | 
| keeping or removing a div with multiple classes | JohnsonZA | Recipes | 1 | 09-25-2010 11:33 AM |