mimic table rows

This is a discussion on "mimic table rows" within the Web Page Design section. This forum, and the thread "mimic table rows 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 Apr 12th, 2007, 16:12
Junior Member
Join Date: Jun 2006
Location: Wisconsin
Age: 30
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
mimic table rows

I'm from the old school way of making websites using tables. I'm trying to show an icon and then right underneath the icon show a title. Similar to how it is on your desktop. I'm pulling the data out of a database, so I have no idea how many items there will be.

Normally I would use tables for this, however, people are always telling me I should learn to use just css, so i'm trying. I was able to use a span element to simply show the icon and it worked great, but I can't figure out where to look to try and get the title to align nicely underneath. I'll show you my "table way".

Code: Select all
<table>
 <tr>
  <td>
    <table>
     <tr>
      <td><img src='image1.gif'></td>
     </tr>
     <tr>
      <td>Title1</td>
     </tr>
    </table>
  </td>
  <td>
    <table>
     <tr>
      <td><img src='image2.gif'></td>
     </tr>
     <tr>
      <td>Title2</td>
     </tr>
    </table>
  </td>
  <td>
    <table>
     <tr>
      <td><img src='image3.gif'></td>
     </tr>
     <tr>
      <td>Title3</td>
     </tr>
    </table>
  </td>
 </tr>
 <tr>
  <td>
    <table>
     <tr>
      <td><img src='image4.gif'></td>
     </tr>
     <tr>
      <td>Title4</td>
     </tr>
    </table>
  </td>
  <td>
    <table>
     <tr>
      <td><img src='image5.gif'></td>
     </tr>
     <tr>
      <td>Title5</td>
     </tr>
    </table>
  </td>
  <td>
    <table>
     <tr>
      <td><img src='image6.gif'></td>
     </tr>
     <tr>
      <td>Title6</td>
     </tr>
    </table>
  </td>
 </tr>
</table>
i would really appreciate a good css explanation on how to accomplish this.

Thank you

Last edited by karinne; Apr 12th, 2007 at 16:47. Reason: I change th [html] to [code] since we're having problems with that tag.
Reply With Quote

  #2 (permalink)  
Old Apr 12th, 2007, 16:50
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: mimic table rows

Well ... the simplest way would be

HTML
Code: Select all
<div class="icons">
    <img src="image.jpg" width="" height="" alt="" /><br />
    Title1
</div>
CSS

Code: Select all
.icons {
   text-align: center;
   float: left;
   width: 200px;
   height: 200px;
}
Something like this ... haven't tested but that should be close enough with a few modifications like the width and height for the class. You might want to change those.
Reply With Quote
  #3 (permalink)  
Old Apr 12th, 2007, 17:05
Junior Member
Join Date: Jun 2006
Location: Wisconsin
Age: 30
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Re: mimic table rows

wouldn't it break after each div? Or is that what the float:left is eliminating?
Reply With Quote
  #4 (permalink)  
Old Apr 12th, 2007, 17:06
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: mimic table rows

You got it
Reply With Quote
  #5 (permalink)  
Old Apr 13th, 2007, 23:24
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
Re: mimic table rows

Just a note, if you want only three items per line, you can add an extra class to every third <div> so it will wrap without a container.

Code: Select all
<div class="icon">
    <img src="image1.gif" />
    Title
</div>
<div class="icon">
    <img src="image2.gif" />
    Title
</div>
<div class="icon clear">
    <img src="image3.gif" />
    Title
</div>
Code: Select all
.icon {
    width: 100px;
    text-align: center;
    float: left;
}
.clear {
    clear: left;
}
Reply With Quote
  #6 (permalink)  
Old Apr 13th, 2007, 23:30
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: mimic table rows

That's a good tip. Had not thought of that!
Reply With Quote
Reply

Tags
css, tables

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
Placing pictures in rows casho Website Planning 9 Nov 29th, 2007 17:46
Columns and Rows tlo5 JavaScript Forum 4 Nov 20th, 2007 16:13
mimic iframe c010depunkk Web Page Design 7 Aug 1st, 2007 06:30
IE Fast rows insertion. ronen JavaScript Forum 1 Mar 21st, 2007 22:51
Customizing table rows AdRock Web Page Design 2 Aug 28th, 2006 09:28


All times are GMT. The time now is 18:55.


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