473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

tables vs CSS

I am trying to replace extraneous tables with CSS but I am running into
centering problems.

I want pictures centered left to right (top aligned) in two columns,
with the accompanying title and info lined up with the left edge of the
pictures. Since the pictures are different sizes, I can't just line
them up on the same left edge. It's all in a table with a fixed width of
500px.

You can see the test page at http://www.happymagpie.com/cssvstables.htm
Note the top table is how I want it to layout.
The second is my CSS attempt, and it's just a mess. Either both the
pictures and text align in the center, or they both align to the far
left of the table.
The table and div borders are temporarily turned on but will not be in
the final draft.

I don't expect to be able to do this completely table-free. I just want
to get rid of the nested tables.
Phil

--really bad code----

<style type="text/css">
/* formatting for nested tables */

..diagcell {
padding:2px;
/*width:auto; */
border: solid #990000;
}

..ebg, .ebg2 {
color:#0000CC;
background:white;
font-size:1.5em;
font-weight:bold;
border: 3px dotted #0000CC;
}

/* second Div-table*/

..diagcell2 {
text-align:center;
padding:2px;
width:100%;
border: solid #009900;
}

..diagcell2 td { text-align:center; }

..diagcell3 {
text-align:center;
padding:2px;
width:100%;
border: solid #999900;
}
..ebg2 {text-align:left;}

</style>

--scrap of html--

<table class="diagcell2" border="1" width="500">
<tr>
<td>
<div class="diagcell3">
<div class="ebg2">
AT-ST Walker
</div>
<img src="pics/atst_3bw.gif" name='ATST' alt="My favorite part of
RotJ" height=100 width=100 border=0>
<br>
Large <a HREF="#">1</a> &nbsp;
<a HREF="#">2</a> &nbsp;
<a HREF="#">3</a>
<br>
Large <a HREF="#">1</a> &nbsp;
<a HREF="#">2</a> &nbsp;
<a HREF="#">3</a>
<br>

</div>
</td>
<td>

<div class="diagcell3"> <div class="ebg2">
Slave I
</div>
<img src=pics/slavei_2bw.gif name='SLAVEI' alt="Slave I - Fett's ship"
border=0 height=100 width=175 >
<br>
Large <a HREF="#">1</a> &nbsp;
<a HREF="#">2</a> &nbsp;
<a HREF="#">3</a>
<br>
Large <a HREF="#">1</a> &nbsp;
<a HREF="#">2</a> &nbsp;
<a HREF="#">3</a>
<br>
</div>
</td>
</tr>
<tr>
<td>
<div class="diagcell3">
<div class="ebg2">
Destroyer droid
</div>
<img src=pics/drdka_2bw.gif name='DROIDEKA' alt="Folded and photo'd
by Lar deSouza" height=100 width=110 border=0 >
<br>
Large <a HREF="#">1</a> &nbsp;
<a HREF="#">2</a> &nbsp;
<a HREF="#">3</a>
<br>
Large <a HREF="#">1</a> &nbsp;
<a HREF="#">2</a> &nbsp;
<a HREF="#">3</a>
<br>
</div>
</td>
<td>

<div class="diagcell3">
<div class="ebg2">
Star Destroyer
</div>
<img src=pics/sdestry_3bw.gif name='ISD' alt="ISD Chimaera"
height=100 width=150 border=0 >
<br>
Large <a HREF="#">1</a> &nbsp;
<a HREF="#">2</a> &nbsp;
<a HREF="#">3</a>
<br>
Large <a HREF="#">1</a> &nbsp;
<a HREF="#">2</a> &nbsp;
<a HREF="#">3</a>
<br>
</div>

</td>
</tr>
</table>

Jul 20 '05 #1
3 2353
Philip schrieb:

I am trying to replace extraneous tables with CSS but I am running into
centering problems.

You can see the test page at http://www.happymagpie.com/cssvstables.htm
Note the top table is how I want it to layout.


I remember those, it's nice to see your origami again!

What we have here is the usual "image-with-caption" problem, but with an
added twist since you have text above and below the image. Check out
e.g. <http://realworldstyle.com/thumb_float.html> or
<http://css-discuss.incutio.com/?page=FloatLayouts> for some nice
solutions you might be able to adjust.

May the Fold be with you.

Matthias
Jul 20 '05 #2
Matthias Gutfeldt wrote:
Philip schrieb:
I am trying to replace extraneous tables with CSS but I am running into
centering problems.

You can see the test page at http://www.happymagpie.com/cssvstables.htm
Note the top table is how I want it to layout.

I remember those, it's nice to see your origami again!

What we have here is the usual "image-with-caption" problem, but with an
added twist since you have text above and below the image. Check out
e.g. <http://realworldstyle.com/thumb_float.html> or
<http://css-discuss.incutio.com/?page=FloatLayouts> for some nice
solutions you might be able to adjust.

May the Fold be with you.

Matthias


Small world! I thought I was looking at the wrong list for a moment.

I had previously seen one of the sites you had mentioned, but didn't
think it applied to me. Finally went back and read both of them
CAREFULLY, and managed to piece it together.

I just need two divs to do it, too.

Thanks for the links,
Phil

(for those of you interested, the final code follows...)
Have only tested it on IE6 and Mozilla 1.4. The issues that kept messing
me up were this:
-IE would center the inner (diagcell) box, but Mozilla refused to do it
until I added the margin-right:auto; and margin-left:auto;

-I had to set an arbitrarily too-small size to the diagcell div.
(without it, the box automatically resized to the larger div, so there
was no effective centering.) Oddly enough, IE would resize the diagcell
div border automatically. Mozilla does not, with the img and text
spilling out. Setting the height:auto solved this. As long as I won't
have borders displayed, this is a non-problem.

-Note the <nobr> tags. They werenecessary for any titles that were wider
than image. I wound up using them judiciously on the text underneath as
well. Not the most flexible solution, but it worked for me.

-Since the pictures were of different sizes, the final boxes were uneven
and the automatic screen wrap was funky.
I wound up putting a clear:both after each row to keep it neat.
Fortunately, this is all in a fixed-width container, so another
non-problem. If I was using a dnamic-sized window, I would have had
problems.
---Css --
<style type="text/css">
..diagtable {
text-align:center;
float:left;
width:235px;
}

..diagcell {
margin-right:auto; /* IE doesn't need these but MOZ does */
margin-left:auto;
text-align:left;
width:100px; /* otherwise it's too big. IE adjusts, but MOZ
overruns. */
height:auto; /* IE doesn't need these but MOZ does */
}
</script>

<div class="diagtable" >
<div class="diagcell" >
<nobr>Long Title</nobr><br>
<img>
Descriptive text.
</div>
</div>

<div class="diagtable" >
<div class="diagcell" >
<nobr>Long Title</nobr><br>
<img>
Descriptive text.
</div>
</div>
<p style="clear:both;" />

Jul 20 '05 #3
Philip wrote:
Matthias Gutfeldt wrote:
Check out e.g. <http://realworldstyle.com/thumb_float.html> or
<http://css-discuss.incutio.com/?page=FloatLayouts> for some nice
solutions you might be able to adjust.

May the Fold be with you.

Small world! I thought I was looking at the wrong list for a moment.


Hehe :-).

I had previously seen one of the sites you had mentioned, but didn't
think it applied to me. Finally went back and read both of them
CAREFULLY, and managed to piece it together.


Yippeeeh!
Matthias
Origamians never die. They just unfold.
Jul 20 '05 #4

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

Similar topics

44
by: Mariusz Jedrzejewski | last post by:
Hi, I'll be very grateful if somebody can explain me why my Opera 7.23 (runing under linux) doesn't show me inner tables. Using below code I can see only "inner table 1". There is no problem with...
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
11
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my...
2
by: Jill Elaine | last post by:
I am building an Access 2002 frontend with linked tables to an encrypted Paradox 7 database. When I first create these linked tables, I'm asked for the password to the encrypted Paradox database,...
1
by: Shelby | last post by:
Problem: My company generates its own data export from a propietary database. These (free) tables can be read in C#.NET using a Visual FoxPro driver (vfpoledb). I can read each of the six tables...
59
by: phil-news-nospam | last post by:
In followups by Brian O'Connor (ironcorona) to other posts, he repeats the idea that using tables in CSS is not something that should be done because IE doesn't support it. Of course I'm not happy...
5
by: rdemyan via AccessMonster.com | last post by:
I have a need to add another field to all of my tables (over 150). Not data, but an actual field. Can I code this somehow. So the code presumabley would loop through all the tables, open each...
4
by: db2admin | last post by:
Hello, I want to plan rearranging tables in our database according to business areas. say all tables in business area A will be in seperate tablespace or tablespaces. I am planning to monitor...
25
by: bubbles | last post by:
Using Access 2003 front-end, with SQL Server 2005 backend. I need to make the front-end application automatically refresh the linked SQL Server tables. New tables will be added dynamically in...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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...

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.