Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 12-29-2025, 04:36 AM   #1
icearch
Enthusiast
icearch began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Nov 2025
Device: none
Which one do you prefer?

I’m working on some project and learning formatting on the go. Then I came to this question:



I have two method that accomplish the same effect :


Code:
<div class="yinyong">
<p>边栏:铁与妖精</p>
<p class="main-ss">随身携带铁器是个绝佳的保命方法,铁乃所有妖精的克星。你常会听到“寒铁”这个说法,但其实任何形态的铁都能有效防御妖精种。我们世界中无处不在的铁器,正是限制精灵在此界活动程度的重要因素。</p>
</div>

Code:
<blockquote>
<p>边栏:铁与妖精</p>
<p class="main-ss">随身携带铁器是个绝佳的保命方法,铁乃所有妖精的克星。你常会听到“寒铁”这个说法,但其实任何形态的铁都能有效防御妖精种。我们世界中无处不在的铁器,正是限制精灵在此界活动程度的重要因素。</p>
</blockquote>

And the corresponding CSS:

Code:
.yinyong
{
	margin-left:0.8em; 
	padding-left:1em; 
	border-left:solid;
	border-width:0.2em;

}

Code:
blockquote
{
	margin-left:0.8em; 
	margin-right:0em; 
	padding-left:1em; 
	padding-right:0em;
	border-left:solid;
	border-width:0.2em;

}

So which one do you prefer in the content of code integrity and easy for maintenance?

Last edited by icearch; 12-29-2025 at 04:42 AM.
icearch is offline   Reply With Quote
Old 12-29-2025, 05:31 AM   #2
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 49,204
Karma: 174632678
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Whichever you prefer. Other than wondering why you have the padding-right and margin-right lines in only one of the CSS entries, it comes down to personal preferences. I would prefer the blockquote but as already mentioned, that would be a personal preference.
DNSB is online now   Reply With Quote
Old 12-29-2025, 05:36 AM   #3
icearch
Enthusiast
icearch began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Nov 2025
Device: none
Quote:
Originally Posted by DNSB View Post
Whichever you prefer. Other than wondering why you have the padding-right and margin-right lines in only one of the CSS entries, it comes down to personal preferences. I would prefer the blockquote but as already mentioned, that would be a personal preference.
Because blockquote have defult marging and padding to the right which div didn't, so to accomplish the same outcome it needs to be addressed.

Padding-right should have no effect, I just forget to delete it.
icearch is offline   Reply With Quote
Old 12-29-2025, 05:47 AM   #4
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 49,204
Karma: 174632678
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by icearch View Post
Because blockquote have defult marging and padding to the right which div didn't, so to accomplish the same outcome it needs to be addressed.

Padding-right should have no effect, I just forget to delete it.
True. My tendency is adding both the left and right margin/padding elements to make sure that I am overriding any defaults that may have been set higher in my CSS.
DNSB is online now   Reply With Quote
Old 12-29-2025, 06:12 AM   #5
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 81,367
Karma: 150264805
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by icearch View Post
Because blockquote have defult marging and padding to the right which div didn't, so to accomplish the same outcome it needs to be addressed.

Padding-right should have no effect, I just forget to delete it.
You can forget the padding and use left/right/top/bottom margins as needed for the blockquote.

I set blockquote to a left/right margin of 1.5em. I know the default is 1em for top/bottom, but I have it in there anyway. The default left/right margins is 2em.
Code:
blockquote {
  margin-top: 1em;
  margin-right: 1.5em;
  margin-bottom: 1em;
  margin-left: 1.5em;
}
JSWolf is offline   Reply With Quote
Old 12-29-2025, 06:56 AM   #6
icearch
Enthusiast
icearch began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Nov 2025
Device: none
After second thought, I think I might well just stick to div, as though some reader might override my css, div still have much better backward compatibility than blockquote. Some random niche reader might have trouble rendering blockquote, and in case someone do override my css, div still is my perfer style, especially on smartphone that have reletively narrow screen, it just can't afford that extra margin comes with blockquote.
icearch is offline   Reply With Quote
Old 12-29-2025, 07:36 AM   #7
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 81,367
Karma: 150264805
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by icearch View Post
After second thought, I think I might well just stick to div, as though some reader might override my css, div still have much better backward compatibility than blockquote. Some random niche reader might have trouble rendering blockquote, and in case someone do override my css, div still is my perfer style, especially on smartphone that have reletively narrow screen, it just can't afford that extra margin comes with blockquote.
That's incorrect. Your blockquote's CSS will not be overridden. You do not have to worry about some niche software.

As you can see, you can override the blockquote defaults and set whatever margins you want. Also, if you look at programs such a Kindle and Books, you'll see they have overly wide margins on a phone. It depends one what program you use. Any program that doesn't respect the CSS well enough is garbage and should not be used.

So yes, use a blockquote as that's actually the best way to code a blockquote.
JSWolf is offline   Reply With Quote
Old 12-29-2025, 08:04 AM   #8
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,576
Karma: 20150435
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by JSWolf View Post
You can forget the padding and use left/right/top/bottom margins as needed for the blockquote.
Except that with a border, you have to use both padding and margin if you want to control the spacing inside and outside the border.

Last edited by Jellby; 12-29-2025 at 09:04 AM.
Jellby is offline   Reply With Quote
Old 12-29-2025, 08:45 AM   #9
icearch
Enthusiast
icearch began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Nov 2025
Device: none
Quote:
Originally Posted by Jellby View Post
Except that with a border, you have to use both padding and margin if you want to control the spacing inside and outside the border.
That's exactly what I have done with the left margin and padding. It adds up to 1em. And chinese characters are always 1em squares, the final result will be so aesthetically pleasing.
icearch is offline   Reply With Quote
Old 12-29-2025, 11:54 AM   #10
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,426
Karma: 20456789
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
As mentioned already, you can set the css for both so they look exactly the same on any device. The only real difference is a semantic one. I would use a <blockquote> when, in fact, coding a long quote. Otherwise I would use a <div>.

Some semantics are more important than others, but if you get in the habit of using the semantically correct tag you will avoid most potential problems.
Turtle91 is offline   Reply With Quote
Old 12-29-2025, 12:21 PM   #11
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: 9,173
Karma: 6565346
Join Date: Nov 2009
Device: many
Quote:
Originally Posted by Turtle91 View Post
As mentioned already, you can set the css for both so they look exactly the same on any device. The only real difference is a semantic one. I would use a <blockquote> when, in fact, coding a long quote. Otherwise I would use a <div>.

Some semantics are more important than others, but if you get in the habit of using the semantically correct tag you will avoid most potential problems.
Very good advice! The importance of using the semantically correct tag for those users with Accessibility needs is high.
KevinH is online now   Reply With Quote
Old 12-29-2025, 05:47 PM   #12
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 81,367
Karma: 150264805
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Turtle91 View Post
As mentioned already, you can set the css for both so they look exactly the same on any device. The only real difference is a semantic one. I would use a <blockquote> when, in fact, coding a long quote. Otherwise I would use a <div>.

Some semantics are more important than others, but if you get in the habit of using the semantically correct tag you will avoid most potential problems.
Why would you use a <div> for a short quote and not a <blockquote>?
JSWolf is offline   Reply With Quote
Old 12-29-2025, 08:37 PM   #13
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,426
Karma: 20456789
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
The <blockquote> HTML element indicates that the enclosed text is an extended quotation, usually not a short one liner. This is visibly offset from the regular text somehow.

Code:
<blockquote cite="https://screenrant.com/star-wars-best-yoda-quotes/">
<p>Master Yoda was an endless fount of wisdom to his Jedi proteges in Star Wars, and he had no shortage of quotes distilling that wisdom. Ever since his introduction in The Empire Strikes Back, Yoda has been a symbol of the series, one of the most recognizable characters in all science fiction, and one of the strongest Jedi ever. Always ready to dish out insights into the Force to any other character who needed it (even if they didn't always follow it), Yoda played his role as a teacher perfectly.</p>

<p>Some of his teachings were incredibly quotable, and Yoda's unique speech pattern has elevated some of his wisdom from memorable to iconic. Though wise, he was not a perfect teacher, as one of Yoda's students turned to the dark side. While it can be hard to narrow down the greatest of his sayings, here are 20 of Yoda's best quotes, ones that have the most meaning to the story and provide the most guidance and truth outside the movies.</p>

<p>Part of what made Yoda so wise was that he never stopped searching for wisdom. In Star Wars: Episode II - Attack of the Clones, Yoda seeks a youngling's help with finding Kamino. This proves that Yoda was always open to new knowledge, even from the most unlikely of places. It also showed that keeping an open mind can solve problems that seem to have no solution.</p>

<p class="sig">~ <cite>Marcelo Leite</cite>, Aug 2024</p>
</blockquote>
There is no need to offset a short quote visibly...it just flows with the text
Code:
<p>I was listening to the words of wisdom intently.</p>
<p>"Into the flow of normal text, a short quote incorporated is," said Master Yoda.</p>
<p>Now I knew why he was the Master.</p>
Anything else that does not fit within that semantic definition would rightfully fall under a <div>.

For example, a tavern sign, a business card, a handwritten letter...

Code:
<div class="sign">
  <p>Fuller's Tavern</p>
  <img class="floatleft" alt="two steins" src="..."/>
  <img class="floatright" alt="d20" src="..."/>
  <p>Gaming, Grog &amp; Good Times</p>
</div>

<div class="card">
  <img class="center" alt="remote" src="..."/>
  <p>« Gameologist »</p>
</div>

<div class="write">
  <p>Dear Jon,</p>
  <p>I refer to the recent death of the technical manager at your company and hereby apply for the replacement of the deceased Manager.</p>
  <p>Each time I apply for a job, I get a reply that there's no vacancy but in this case I have caught you red-handed and you have no excuse because I even attended the funeral to be sure that he was truly dead and buried before applying.</p>
  <p>Attached to my letter is a copy of my CV and his death certificate.</p>
  <p class="sig">Morbidly yours,<br/><a href="https://www.careeraddict.com/7-funniest-cover-letters"/></p>
</div>
Turtle91 is offline   Reply With Quote
Old 12-29-2025, 09:17 PM   #14
icearch
Enthusiast
icearch began at the beginning.
 
Posts: 28
Karma: 10
Join Date: Nov 2025
Device: none
Quote:
Originally Posted by KevinH View Post
Very good advice! The importance of using the semantically correct tag for those users with Accessibility needs is high.
Talking about semantic, I think to encourage people using more <em> and <strong> instead of <i> and <b>, it is helpful to add dedicated button in Sigil. Last time i checked there are none. Especially the latter ones are longer and people tends not to use them.
icearch is offline   Reply With Quote
Old Yesterday, 08:43 AM   #15
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,426
Karma: 20456789
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
I’ve created two “clips” buttons for exactly that purpose:
Code:
STRONG  <strong>\1</strong>
EM      <em>\1</em>
When you have them on the clips bar it is very easy to use!
Turtle91 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
which do you prefer LH07 General Discussions 33 02-03-2014 08:04 AM
Which one do you prefer more and why? Ganiy General Discussions 63 12-16-2013 08:27 PM
What do you prefer? FullCircleDesign General Discussions 52 08-05-2013 08:33 AM
Which of these books do you prefer Enkidu of Abydos Lounge 43 03-18-2011 09:21 PM
PRS-900 Which dictionary do you prefer? Penforhire Sony Reader 3 01-26-2010 11:10 AM


All times are GMT -4. The time now is 06:17 PM.


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