View Single Post
Old 03-09-2021, 04:53 PM   #5
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,361
Karma: 20212223
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 answer depends on what you are using the <div> for. If you are using it to define a section of text that is styled differently than your "normal" paragraphs, then yes, you can certainly add styling to the div to make that section "stand out".
Code:
p {whatever styling you want for normal paragraphs (98% of the book)}

div.newsarticle {margin:2em - or whatever you want for the div box itself}
div.newsarticle p {whatever special styling you want for paragraphs within the div}
div.newsarticle p.head {whatever styling you want for news article headers}


<body>
<p>This is a normal paragraph.</p>
<p>This is a normal paragraph.</p>
<p>This is a normal paragraph.</p>

  <div class="newsarticle">
    <p class="head">Heading</p>
    <p>This is a news paragraph.</p>
    <p>This is a news paragraph.</p>
    <p>This is a news paragraph.</p>
  </div>

<p>This is a normal paragraph.</p>
<p>This is a normal paragraph.</p>
<p>This is a normal paragraph.</p>
</body>
If, however, you are making the uncultured, uncouth, barbaric, decision to use a <div> to wrap your paragraphs instead of using the paragraph tag <p>, then, first, you need to rethink that approach - use the actual tag designed for the purpose, and second - refer to the first reason!, and third, slap yourself for skipping the first and second reasons and just use the actual tags as they are intended.


Having said all that - I agree with not defining margins for normal paragraphs at all and let the device define the standard margin.

Last edited by Turtle91; 03-09-2021 at 04:57 PM.
Turtle91 is offline   Reply With Quote