Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
How to vertically center text/add padding within a div
Old 08-10-2009, 04:54 PM How to vertically center text/add padding within a div
Snot's Avatar
Super Talker

Posts: 132
Name: Chase
Trades: 0
How do I vertically center text or add padding to it without moving the whole div?

Right now the text is sitting on the bottom of the div.


Code:
 #footer {
    color: #FFFFFF;
    background: url(images/bottom.jpg) repeat-x;
    font-weight: bold;
}

Thanks
__________________

Please login or register to view this content. Registration is FREE
Snot is offline
Reply With Quote
View Public Profile Visit Snot's homepage!
 
 
Register now for full access!
Old 08-10-2009, 06:07 PM Re: How to vertically center text/add padding within a div
angele803's Avatar
Perfectly Imperfect

Posts: 1,774
Name: Stephanie
Location: Oklahoma
Trades: 2
If your text is in a paragraph tag, just add bottom padding to the paragraph.
__________________

Please login or register to view this content. Registration is FREE
angele803 is offline
Reply With Quote
View Public Profile
 
Old 08-10-2009, 06:55 PM Re: How to vertically center text/add padding within a div
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://www.candsdesign.co.uk/referen...ertical-align/
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-10-2009, 08:10 PM Re: How to vertically center text/add padding within a div
Snot's Avatar
Super Talker

Posts: 132
Name: Chase
Trades: 0
When I don't use <p> tags it looks like it just needs to have to text centered vertically.

Code:
<div id="footer">&copy; 2006 all rights reserved.<img src="images/bottom.jpg" width="50" height="54" alt="Bottom Border"></div>
But when I add the <p> tags it changes the image behind the text and messes it up.

Code:
<div id="footer"><p>&copy; 2006 all rights reserved.<p><img src="images/bottom.jpg" width="50" height="54" alt="Bottom Border"></div>
Could I just make another div tag and set the text where I want it instead of having it in the same div as the image?
__________________

Please login or register to view this content. Registration is FREE
Snot is offline
Reply With Quote
View Public Profile Visit Snot's homepage!
 
Old 08-10-2009, 09:44 PM Re: How to vertically center text/add padding within a div
TripleMoons's Avatar
Webmaster Talker

Posts: 614
Name: Stephanie Kunder
Location: Hanover, PA
Trades: 0
Create a p.class.

For example...

CSS
Code:
p.footer {
    text-align: center;
    padding: 10px 0px;
}
HTML
Code:
<div id="footer"><p class="footer">&copy; 2006 all rights reserved.<p><img src="images/bottom.jpg" width="50" height="54" alt="Bottom Border"></div>
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

TripleMoons is offline
Reply With Quote
View Public Profile Visit TripleMoons's homepage!
 
Old 08-10-2009, 10:57 PM Re: How to vertically center text/add padding within a div
Snot's Avatar
Super Talker

Posts: 132
Name: Chase
Trades: 0
Oh Sweet!!!

Thanks so much for the help that worked great!!!
__________________

Please login or register to view this content. Registration is FREE
Snot is offline
Reply With Quote
View Public Profile Visit Snot's homepage!
 
Old 08-11-2009, 01:25 AM Re: How to vertically center text/add padding within a div
Ninja's Avatar
Experienced Talker

Posts: 30
Trades: 0
1) Your css is adding and repeating the image so remove <img> from within your <div>
Code:
#footer {
    color: #FFFFFF;
    background: url(images/bottom.jpg) repeat-x;
    font-weight: bold;
}
Code:
<div id="footer"><p>&copy; 2006 all rights reserved.<p></div>
2) No need to add a class to <p> Style with
Code:
#footer p{
    text-align: center;
    padding: 10px 0px;
}

Last edited by Ninja; 08-11-2009 at 01:27 AM..
Ninja is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How to vertically center text/add padding within a div
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26821 seconds with 12 queries