homepage Welcome to WebmasterWorld Guest from 54.197.94.241
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
Spacing between paragraphs
Any reason not to using css padding?
louponne




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

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




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

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




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

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




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

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




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

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




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


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




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

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




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

*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. ;)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved