468,290 Members | 1,954 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,290 developers. It's quick & easy.

layout within <td>

How can I get the following to appear on just 1 line?

<style type="text/css">
#center { text-align: center;}
#left { text-align: left;}
#right {text-align: right}
</style>

<table border=1 width=200>
<tr>
<td>
<div id="left">left
<div id="center">center
<div id="right">right
</td>
</tr>
</table>

I tried using "display:inline" and play with "float" property but
couldn't get it to work right.
Thanks!

Radek

Jul 21 '05 #1
3 3455
On 10 May 2005 08:14:39 -0700, "Radek" <ra*********@firstlogic.com>
wrote:
How can I get the following to appear on just 1 line?


You want to be spoonfed?

Note that it is highly recommended to stay away from pixel sized
elements in a real design.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>Your own title here</TITLE>
<style type="text/css">
body {
margin: 0; border: none; padding: 0;
font-size: 100%;
}
table {
margin: 0; padding: 0;
border: solid 1px #000000;
}
td {
margin: 0; border: none; padding: 0;
width: 210px;
}
.left {
margin: 0; border: none; padding: 0;
text-align: left; width: 70px; float: left;
}
.center {
margin: 0; border: none; padding: 0;
text-align: center; width: 70px; float: left;
}
.right {
margin: 0; border: none; padding: 0;
text-align: right; width: 70px; float: left;
}
</style>
</HEAD>
<BODY>
<table>
<tr>
<td>
<div class="left">left</DIV>
<div class="center">center</DIV>
<div class="right">right</DIV>
</td>
</tr>
</table>
</BODY>
</HTML>

--
Rex
Jul 21 '05 #2
*Radek*:
<tr><td>
<div id="left">left
<div id="center">center
<div id="right">right
</td></tr>


Any reason for not using three distinct table cells (or for not closing
your 'div' elements)?
Jul 21 '05 #3
Thanks for your help! Not closing the <div> elements was my mistake
(sorry). Putting everything in 3 different table cells that's
unfortunately is not an option. I'd also want to stay away from
hardcoding the pixel sizes. I'd be happy with the output that I'm
getting in my original example if everything was simply on 1 line (I
though that's what "display:inline" was supposed to do but that doesn't
seem to be the case).

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by bissatch | last post: by
1 post views Thread by prefersgolfing | last post: by
1 post views Thread by test9991014 | last post: by
reply views Thread by NPC403 | last post: by
2 posts views Thread by MrBee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.