padding content

This is a discussion on "padding content" within the Web Page Design section. This forum, and the thread "padding content are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old May 2nd, 2007, 10:38
Junior Member
Join Date: Aug 2006
Location: Lancashire, UK
Age: 28
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
padding content

I want to position some graphics inside a div (e.g.footer) I know that if the content is text (p) I can use the following:
Code: Select all
#test {
float:left;
width:220px;
background-color:#FFFFFF;
}
#test .footer {
background: url(../img/lSm_bottom.gif) no-repeat;
height: 46px;
}
#test .footer p {
padding:10px;
}
However I need to put in a series of buttons, I can add in another div with padding but is there a cleaner way than below (nesting divs)? I was thinking if there was a way of saying "all content weather it be text/images to be styled"

Code: Select all
<div id="test">
<div class="footer">
<div class="pad">
<img src="http://www.webforumz.com/images/headers/imgName1.gif" alt="#" width="50" height="20" border="0" />
<img src="http://www.webforumz.com/images/headers/imgName2.gif" alt="#" width="50" height="20" border="0" />
</div>
</div>
</div>
Code: Select all
#test {
float:left;
width:220px;
background-color:#FFFFFF;
}
#test .footer {
background: url(../img/lSm_bottom.gif) no-repeat;
height: 46px;
}
#test .footer .pad {
padding:10px;
}
Thanks

Last edited by karinne; May 2nd, 2007 at 11:52. Reason: Please use [code]...[/code] tags when displaying code!
Reply With Quote

  #2 (permalink)  
Old May 2nd, 2007, 11:52
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: padding content

Do you have a visual example of what you are trying to achieve!?!
Reply With Quote
  #3 (permalink)  
Old May 2nd, 2007, 12:06
Junior Member
Join Date: Aug 2006
Location: Lancashire, UK
Age: 28
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Re: padding content

None that i have hosted anywhere. its just if you add padding to the 'footer' style it displays different in various browsers (some add the padding value to the height, others dont) so the only way I have seen to fix this is to add a nested div and put the padding on that. I dont know if this is correct though because you end up with more and more nested divs?
Reply With Quote
  #4 (permalink)  
Old May 2nd, 2007, 12:13
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: padding content

Alright ... how about a link then so we can see what's going on?
Reply With Quote
  #5 (permalink)  
Old May 3rd, 2007, 13:10
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: padding content

Purists may gag, but you can ninja pad it.

Vertical: use <br class=> and use the class to set line-height. This is actually a nice touchup command, IMO.

Horizontal: use <span class=>&nbsp; </span> and use fontsize and/or letterspacing in the class. This is less satisfactory due to control issues over font-size display, although if all you are trying to control is the padding per se (and not the fit) it will work fine with a fixed font unit like pt.

Another old and REALLY noobie method is to use a transparent graphic as a spacer. Even I wouldn't do this, LOL.

And for a third idea, with more "pure" css, if you can center-align the main div contents, you can pad every element except the left pad on the leftmost element and the right pad on the rightmost element, or you can have 0 horizontal padding on the content elements and use a padding spacer between them (which is frequently done with horizontal lists). This works very nicely as long as the line doesn't exceed the space, but again, it's vulnerable to user-determined font size.
Reply With Quote
  #6 (permalink)  
Old May 3rd, 2007, 18:43
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,993
Blog Entries: 1
Thanks: 0
Thanked 32 Times in 32 Posts
Re: padding content

The world should be wrapped in <blink></blink> tags.
__________________
I hate IE 6. Just sayin....
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
Reply

Tags
positioning, padding, content

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Expandable Content Script (Swtich Content) Matc JavaScript Forum 0 Apr 8th, 2008 10:53
Padding In IE Monie Web Page Design 7 Feb 12th, 2008 03:36
Content Placement + Content Dividing josephman1988 Website Planning 2 Jan 22nd, 2008 05:02
CSS padding Firefox vs IE WL1207 Web Page Design 5 Oct 18th, 2007 13:56
Disappearing padding in IE diagonalArgument Web Page Design 1 Jan 8th, 2006 14:03


All times are GMT. The time now is 02:37.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43