Reply LinkBack Thread Tools Search this Thread
Old 16-09-2007, 10:34   #1 (permalink)
choppy
Registered User
 
Join Date: Jul 2004
Location: Malaysia
Posts: 8
Send a message via ICQ to choppy
CSS: Text mustn't wrap under image.

Hello, I could use some help with the above, please.

Here is the page I'm designing:
orbitingscientific DOT com / products.html

Originally I had used a 4 x 4 table, now CSS.
Although the text now wraps under the logos
if a user increases font size.

Can this be prevented?

Here's the code from my stylesheet:

div.products {
float: left;
width: 322px;
height: 10em;
margin-bottom: 0.5em;
}
div.products img{
float: left;
padding: 4px;
border: 0;
}

And the XHTML is:

<div class="products">
<a href="nic.html"><img src="images/p_nic.gif" alt="NIC" /></a>
<strong>NIC</strong> specializes in <strong>mercury analyzers</strong>, from
portable units to custom-built on-line process analyzers.
</div>

Thanks,
C K Yap
Malaysia

Last edited by choppy : 16-09-2007 at 11:24.
  Reply With Quote
Old 16-09-2007, 14:19   #2 (permalink)
foolfodder
Registered User
 
Join Date: Aug 2007
Posts: 91
Maybe try putting the text in a <p> and then give the p a left-margin
  Reply With Quote
Old 16-09-2007, 15:45   #3 (permalink)
herkalees
Semantics, yay.
 
herkalees's Avatar
 
Join Date: Nov 2005
Location: Salem, Massachusetts
Posts: 1,088
div.products {
float: left;
width: 322px;
height: 10em;
margin-bottom: 0.5em;
}
a.productImg {
float: left;
padding: 4px;
border: 0;
width: 200px; /* Change this to the real width of the image */
}
p.productDecription {
margin-left: 220px; /* Change this to the real width of the image, plus some more for white-space */
}


Code:
<div class="products"> <a href="nic.html" class="productImg"><img src="http://www.designerstalk.com/forums/images/p_nic.gif" alt="NIC" /></a> <p class="productDescription"><strong>NIC</strong> specializes in <strong>mercury analyzers</strong>, from portable units to custom-built on-line process analyzers.</p> </div>
__________________
  Reply With Quote
Old 16-09-2007, 21:04   #4 (permalink)
choppy
Registered User
 
Join Date: Jul 2004
Location: Malaysia
Posts: 8
Send a message via ICQ to choppy
Thank you, guys. I'm very new to CSS and I
appreciate the help.

I came up with a solution of my own while sleeping
(!). Just pad the image with 2em underneath.

Leaner code, but I know it's un-robust / cheating.
Sometimes I long for my <td> and <tr>. Life
was simple.

But I will bear your solutions in mind should the
descriptions lengthen.

- yap

Last edited by choppy : 16-09-2007 at 23:14.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8