By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,492 Members | 1,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,492 IT Pros & Developers. It's quick & easy.

layout within <td>

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
*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

P: n/a
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.