473,498 Members | 1,911 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert 6-column table to CSS layout

Hiya,

I'm trying to convert a table with 6 colums that looks like this:

<table class="myTable" width="640px">
<tr>
<td><a href="#">
<img src="../_img/announce.gif" align="middle" border="0"></a>
</td>
<td><a href="#">
<span style="FONT-WEIGHT: bold; FONT-SIZE: 12px">
Announcements
</span></a><br />
Happy Ad; Seminars: Obituaries; Special Announcements
</td>
<td><a href="#">
<img src="../_img/new_icons/auction.jpg" align="middle"
border="0"></a>
</td>
<td><a href="#">
<span style="FONT-WEIGHT: bold; FONT-SIZE: 12px">
Auction/Flea Market/Yard Sale
</span></a><br />
Auctions; Flea Market; Garage Sales
</td>
<td><a href="#">
<img src="../_img/new_icons/Antiques.jpg" align="middle"
border="0"></a>
</td>
<td><a href="#">
<span style="FONT-WEIGHT: bold; FONT-SIZE: 12px">
Antiques/Collectibles
</span></a>
<br />Antiques; Collectibles

</td>
</tr>
<tr>
<td><a href="#">
<img src="../_img/new_icons/appliances.gif"
align="middle" border="0"></a>
</td>
<td><a href="#">
<span style="FONT-WEIGHT: bold; FONT-SIZE: 12px">
Appliances
</span></a>
<br />Appliances
</td>
<td>
<a href="#">
<img src="../_img/transportation.gif" align="middle"
border="0">

</td>
<td><a href="#">
<span style="FONT-WEIGHT: bold; FONT-SIZE: 12px">
Automotive/Transportation
</span></a><br />
New; Used; Rental; Motorcycles; Recreational; Repair;
Parts
</td>
<td><a href="#">
<img src="../_img/finance.gif" align="middle"
border="0"></a>
</td>
<td><a href="#">
<span style="FONT-WEIGHT: bold; FONT-SIZE: 12px">
Banking
</span></a>
<br />Banks; Credit Unions; Mortgages
</td>
</tr>

<tr>
<td><a href="#">
<img src="../_img/new_icons/boating.jpg"
align="middle" border="0"></a>
</td>
<td><a href="#">
<span style="FONT-WEIGHT: bold; FONT-SIZE: 12px">
Boating
</span></a>
<br />New; Used; Service; Marinas
</td>
<td>
<a href="#">
<img src="../_img/new_icons/Bridal.jpg" align="middle"
border="0">

</td>
<td><a href="#">
<span style="FONT-WEIGHT: bold; FONT-SIZE: 12px">
Bridal
</span></a><br />
Wedding Services
</td>
<td><a href="#">
<img src="../_img/new_icons/childcare.gif"
align="middle" border="0"></a>
</td>
<td><a href="#">
<span style="FONT-WEIGHT: bold; FONT-SIZE: 12px">
Childcare
</span></a>
<br />Preschool; Day Care
</td>
</tr>
</table>
....to a CSS layout. The only catch is I need to keep it within 640px
(630px ideally). The styling associated with "myTable" is mainly font
properties and does not need to be preserved. If anyone has a
suggestion on how to pull this off I would greatly appreciate it.

see it in action here:

http://adamdesigns.com/csstable.html

Sincerely,
Adam

Jun 15 '07 #1
1 4050
On 15 Jun, 19:56, akr...@gmail.com wrote:
I'm trying to convert a table with 6 colums that looks like this:
...to a CSS layout.
Why? What are you trying to get from this? There's no point in chasing
a vague "CSS must be better than <table>" goal, because you'll never
know if you've achieved it. What real, concrete benefit are you
expecting to see from re-working this design?

I don't like the 6 column table. This is because adjacent pairts of
columns are being used for a purely-layout purpose that doesn't
require a <table>. This is the case where "<tableis inherently bad".

As to re-doing it with a 3 column <table>, then I'd have no problem
with that. It's a "<tableused for layout", but that's OK so long as
you're only doing it because you want to preserve a grid structure
(i.e. elements are always to be arranged in this 3x2 format).

To do this, find a way to suitably place all three elements of the
"menu item" (image, title, strapline) into a container, i.e. a <div>,
probably with a class on it. Then place 6 of these <div>s into a
<table>, one per cell.

If you want the finished page to behave differently, then you might
use a different design. Coincidentally this would avoid the <table>,
but you're doing it this way _to_get_different_fluid_behaviour_, not
just to mechanically avoid a <table>. Use the same 6 <div>s as before,
but this time make each one float left too. You'll probably set their
widths explicitly too, so that they're consistent. Now place all 6 of
them into a single container, of constrained width according to the
size of the page. They'll now flow and arrange themselves as best they
can, according to the container overall width. They might be 3x2, 2x3
or something else, depending on how they fit. This gives better (i.e.
more flexible) behaviour for varying window sizes.

The only catch is I need to keep it within 640px
(630px ideally).
No you don't. You need to make it work within whatever space _my_
browser says you can have.
Jun 18 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1787
by: Logan X via .NET 247 | last post by:
It's official....Convert blows. I ran a number of tests converting a double to an integer usingboth Convert & CType. I *ASSUMED* that CType would piggy-back ontop of Convert, and that performance...
4
3598
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is...
7
7070
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done...
3
10238
by: Convert TextBox.Text to Int32 Problem | last post by:
Need a little help here. I saw some related posts, so here goes... I have some textboxes which are designed for the user to enter a integer value. In "old school C" we just used the atoi function...
7
29149
by: patang | last post by:
I want to convert amount to words. Is there any funciton available? Example: $230.30 Two Hundred Thirty Dollars and 30/100
6
1407
by: patang | last post by:
Could someone please tell me where am I supposed to put this code. Actually my project has two forms. I created a new module and have put the following code sent by someone. All the function...
4
4501
by: Edwin Knoppert | last post by:
In my code i use the text from a textbox and convert it to a double value. I was using Convert.ToDouble() but i'm used to convert comma to dot. This way i can assure the text is correct. However...
1
3566
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in...
6
4239
by: Ken Fine | last post by:
This is a basic question. What is the difference between casting and using the Convert.ToXXX methods, from the standpoint of the compiler, in terms of performance, and in other ways? e.g. ...
0
10705
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
7002
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7203
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4908
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4588
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
290
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.