View Single Post
Old 02-26-2018, 12:36 PM   #39
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: 80,192
Karma: 148951761
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 GrannyGrump View Post
So... if I want to style, for example, a "For Sale" sign.

I should style it as such:
<div class="centrd">FOR SALE</div>
<div class="centrd">FRESH STRAWBERRIES</div>
<div class="centrd">ENQUIRE WITHIN</div>


Rather than
<div class="centrd">FOR SALE<br />
FRESH STRAWBERRIES<br />
ENQUIRE WITHIN</div>

I simply do not comprehend why the <br /> is any uglier than multiple <div>s. Plus, you have what might be considered extraneous tags...

Educate me some more, please?
Multiple divs like that are ugly. Why would you use them where p is best?
Here's good code...

.noindent {
text-indent: 0;
}
div.center {
text-align: center;
margin-top: 1em;
margin-bottom: 1em;
}

<div class="center">
<p class="noindent">FOR SALE</p>
<p class="noindent">FRESH BLUEBERRIES</p>
<p class="noindent">INQUIRE WITHIN</p>
</div>
JSWolf is offline   Reply With Quote