Web Design Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignWeb Design Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 22nd, 2004, 05:07 AM
avinalaff avinalaff is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: Hampshire, UK
Posts: 31 avinalaff User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 30 m 48 sec
Reputation Power: 4
Vertical alignment with CSS

Hi,

I have searched high and low for an answer to this problem, however, none of the hacks seem to work for me and I'm not sure what to do now. I have a column (css) which has an image followed by text. All I want to do is vertically center the text against the image but I can't shift it from the image baseline.

The code I am using is as follows:-
+++++++++ CSS ++++++++++
div#leftcol{

width: 180px;
float: left;

padding:0px;
margin:0px;
}

div#leftcol span.svcitem;
line-height:70px;
}

+++++++++ HTML +++++++++
<div id="leftcol">
<span class="svcitem"> <img src="images/admin.jpg" width="61" height="70" alt="Administration" />Administration</span>
<br />
<span class="svciten"> <img src="images/bookeeping.jpg" width="61" height="70" alt="Bookeeping" /> Bookeeping</span>
<br />

etc....

I have tried setting the line height to equal the image, also setting the padding top & bottom to 3px but none of this has worked.

I would be very grateful if anyone could provide some idea of I should try next.

Many thanks in anticipation.

Reply With Quote
  #2  
Old November 22nd, 2004, 08:20 AM
BonRouge's Avatar
BonRouge BonRouge is offline
Winemaster
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Sendai, Japan
Posts: 1,354 BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Weeks 3 Days 3 h 18 m 20 sec
Reputation Power: 86
Try this :

Code:
dd {margin:0; padding:0; position:relative; left:70px; bottom:45px;}


and this :


Code:
<dl>
  	<dt><img src="images/admin.jpg" width="61" height="70" alt="Administration" /></dt>
  	<dd>Administration</dd>
  	<dt><img src="images/bookeeping.jpg" width="61" height="70" alt="Bookkeeping" /></dt>
  	<dd>Bookkeeping</dd>
  </dl>



That should be good for you.

(BTW... You might want to spell bookkeeping correctly)

Reply With Quote
  #3  
Old November 22nd, 2004, 08:48 AM
avinalaff avinalaff is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Location: Hampshire, UK
Posts: 31 avinalaff User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 30 m 48 sec
Reputation Power: 4
Hey, this is great and works perfectly (also you're very good at spelling - thanks). However, I do have one serious concern. As well as adhering to w3c standards, our site must be truly accessible.

Does the use of definition tags for structural layout not flout the 'laws' of accessibility? Is there any way of using this method with structural tags?

Thanks again.

Reply With Quote
  #4  
Old November 22nd, 2004, 09:38 AM
BonRouge's Avatar
BonRouge BonRouge is offline
Winemaster
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2004
Location: Sendai, Japan
Posts: 1,354 BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level)BonRouge User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 3 Weeks 3 Days 3 h 18 m 20 sec
Reputation Power: 86
Not at all - you have something in the 'dt' and you're defining it in the 'dd' - no problem.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignWeb Design Help > Vertical alignment with CSS


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT