Welcome to WebmasterWorld Guest from 54.234.63.187

Forum Moderators: not2easy

Message Too Old, No Replies

Spacing between paragraphs

Any reason not to using css padding?

     

louponne

10:04 am on Apr 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm trying to neaten up the spacing between paragraphs on a site. Instead of using table cellpadding, is there any reason not to do this:

<p class="linespace">bla bla bla.</p>
<p class="linespace">more bla bla bla.</p>

and :

.linespace { margin: 0px; padding: 0px 0px 8px; }

?

idiotgirl

10:16 am on Apr 26, 2003 (gmt 0)

10+ Year Member



If this is a standard throughout all your <p>'s you could simply declare that as your <p> style rather than assigning the class to each paragraph. It would save on code bloat. Then, if you had an alternative <p> style you could create a class or classes just for those.

And, no, there wouldn't be any reason to set your paragraphs in table cells unless you are displaying data. You can use margins or padding, depending on how your page is set up.

louponne

11:18 am on Apr 26, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Many thanks for your reply - no, this isn't a line spacing that I'd want to declare as standard throughout the site, so I definitely want to set it up as a separate style and not modify my <p> throughout the site -

DCElliott

8:14 pm on Apr 29, 2003 (gmt 0)

10+ Year Member



Or, if it is only a certain section where you want the modified <p> spacing, you could use a contextual selector:

div.tightp {display:block;}
div.tightp p {margin: .5em 0;}/*1/2 normal spacing*/
###############
<div class="tightp">
<p>The spacing is tight</p>
<p>'Cuz that's how it looks right.</p>
</div>
<p>And now we have default spacing.</p>

More planning, less writing - always works for me. :)

DE

papabaer

8:27 pm on Apr 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The more you allow normal page flow to carry the work load, the more control you actually have. Yeah, it's kinda of a 'Zen' thing.. but you really have to think about it to understand the underlying truth.

There is no reason at all why you cannot control your paragraphs with margins and/or padding.. but do you really need to? Does it truly add to your design and function.

One example where it IS needed is in the new found trailing paragarph bug present in Opera 7.10 (Opera repeats the trailing default bottom-margin and will break through parent bottom margins.

Here is my own fix:

p.o7 { /* Oprea 7.10 has a paragraph bottom margin bug */
margin-bottom: 0;
padding-bottom: 20px;
}

Nick_W

8:29 pm on Apr 29, 2003 (gmt 0)

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member




the more you allow normal page flow to carry the work load, the more controll you actually exert. Yeah, it's kinda of a 'Zen' thing.. but you really have to think about it to understand the underlying truth.

*Sniffle* - Brings tears to my eyes reading this kind of stuff again. - *Sniffle*

Nick

DCElliott

8:42 pm on Apr 29, 2003 (gmt 0)

10+ Year Member



Absolutely.

While the example class "tightp" could be used, I tend to code semantically (sp?) with different tags taking on different characteristics depending on what #id they reside within. So if I have an div #legalese I might have #legalese p {font-size:0.8em, margin:0.5em 0;} to create the "fine-print" section.

As a rule, I dislike creating divs purely to give me certain presentation characteristics. There should be something about the section that makes it a div in its own right and the presentational characteristics flow from that. Am I making sense?

DE

pageoneresults

8:58 pm on Apr 29, 2003 (gmt 0)

WebmasterWorld Senior Member pageoneresults is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



*Sniffle* - Brings tears to my eyes reading this kind of stuff again. - *Sniffle*

Yeah, back to the sleepless nights experimenting with code and solutions that papabaer posts! Not that I've gotten much sleep with Nick_W around. ;)

 

Featured Threads

Hot Threads This Week

Hot Threads This Month