473,320 Members | 1,794 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,320 software developers and data experts.

align text field and button 2

Hi,

Here is my html:
<table>
<tr>
<td colspan=2>Name <input type=text...><input type=button...></td>
</tr>
<tr>
<td>....</td>
<td>....</td>
</tr>
</table>
The width of the second row (and thus the width of the table) is
changing depending on its content. I want, however, in the first row,
"Name" is always left aligned. The button is always right aligned.
And
the text filed fill all the space between them.
I can not figure out how to do it. Can anyone help?
Thanks,
ff

Feb 21 '07 #1
7 5815
On 2007-02-21, finecur <fi*****@yahoo.comwrote:
Hi,

Here is my html:
<table>
<tr>
<td colspan=2>Name <input type=text...><input type=button...></td>
</tr>
<tr>
<td>....</td>
<td>....</td>
</tr>
</table>
The width of the second row (and thus the width of the table) is
changing depending on its content. I want, however, in the first row,
"Name" is always left aligned. The button is always right aligned.
And
the text filed fill all the space between them.
I can not figure out how to do it. Can anyone help?
The problem is rather difficult. The table's width depends on the
contents of the second row, but you want the widths of things in the
first row to be a function of that computed width.

I have a solution that works in Opera, FF and Konqueror. It's dodgy
because it involves setting percentage widths of auto-width containers,
which the browser is entitled to ignore.

By using a nested table, we dissociate the three columns in the first
row from the three in the second row.

Setting "Name" and "click" to 1px each is intended to make the browser
shrink them to their content minwidth, leaving everything else in the
middle for the text input.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<title>Test Page</title>
<style type="text/css">
td { border: 1px solid green; }
</style>
</head>
<body>
<table>
<tr>
<td colspan="2">
<table style="width: 100%">
<tr>
<td style="width: 1px">Name</td>
<td>
<input type="text" style="width:100%">
</td>
<td style="width: 1px">
<input type="button" value="click">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
content content content content
</td>
<td>
content content
</td>
</tr>
</table>
</body>
</html>
Feb 22 '07 #2
Ben C wrote:
On 2007-02-21, finecur <fi*****@yahoo.comwrote:
>>I can not figure out how to do it.
or post in newsgroups
I have a solution that works in Opera, FF and Konqueror.
[rest of generously provided solution snipped]
finecur should consider itself very, very lucky.

--
John
Feb 22 '07 #3
On 2007-02-22, John Hosking <Jo**@DELETE.Hosking.name.INVALIDwrote:
Ben C wrote:
>On 2007-02-21, finecur <fi*****@yahoo.comwrote:
>>>I can not figure out how to do it.

or post in newsgroups
>I have a solution that works in Opera, FF and Konqueror.

[rest of generously provided solution snipped]
finecur should consider itself very, very lucky.
Actually I have no problem with finecur, since the problem was not
difficult to understand as posted.

The "post a url to a test page that validates" rule is a good one in
general, but if it's clear what the problem is in a few lines of markup
then why not?
Feb 22 '07 #4
Scripsit Ben C:
Actually I have no problem with finecur, since the problem was not
difficult to understand as posted.
You didn't get upset with pointless repetitive postings that indicated
little understanding of the answers so far? (Just a rhetoric question.)
The "post a url to a test page that validates" rule is a good one in
general, but if it's clear what the problem is in a few lines of
markup then why not?
Because there is too little information to know what the problem really was.
We have no explanation for the apparently pointless colspan, for example.

Your proposed a solution that you admitted to be dodgy and declared as
working some browsers, which exclude IE, i.e. most browsing situations. What
possible problem would justify such a solution?

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Feb 22 '07 #5
On 2007-02-22, Jukka K. Korpela <jk******@cs.tut.fiwrote:
Scripsit Ben C:
[...]
>The "post a url to a test page that validates" rule is a good one in
general, but if it's clear what the problem is in a few lines of
markup then why not?

Because there is too little information to know what the problem really was.
We have no explanation for the apparently pointless colspan, for example.
True, the colspan is a puzzle. But the English explanation was clear
enough to me:

finecurThe width of the second row (and thus the width of the table)
finecuris changing depending on its content. I want, however, in the
finecurfirst row, "Name" is always left aligned. The button is always
finecurright aligned. And the text filed fill all the space between
finecurthem.
Your proposed a solution that you admitted to be dodgy and declared as
working some browsers, which exclude IE, i.e. most browsing situations. What
possible problem would justify such a solution?
An interesting problem, which I tried to characterize and presented a
dodgy solution to in the hope that someone would be able to improve on
it.
Feb 22 '07 #6
In article <xy***************@reader1.news.saunalahti.fi>,
"Jukka K. Korpela" <jk******@cs.tut.fiwrote:
Scripsit Ben C:
Actually I have no problem with finecur, since the problem was not
difficult to understand as posted.

You didn't get upset with pointless repetitive postings that indicated
little understanding of the answers so far? (Just a rhetoric question.)
It is quite noticeable and admirable in a
'beyond-the-call-of-duty' sort of a way, how tolerant Ben C is
about these things! Perhaps he had an unusually happy childhood.

--
dorayme
Feb 22 '07 #7
In article <sl*********************@bowser.marioworld>,
Ben C <sp******@spam.eggswrote:
>
The "post a url to a test page that validates" rule is a good one in
general, but if it's clear what the problem is in a few lines of markup
then why not?
The key phase here being "if", of course... :)

--
dorayme
Feb 22 '07 #8

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

Similar topics

5
by: Mikko Rantalainen | last post by:
See example at <URL:http://www.cc.jyu.fi/~mira/moz/formtest.php>. The problem is that the label of submit button is always centered on the button regardsless of 'text-align' property in CSS....
3
by: Stanislav Traykov | last post by:
Hello, I have a question about text positioning in a table field. In particular, I want to create a template which works with images of unknown size. There is a <table> field, in which I need...
0
by: smr78 | last post by:
Hi, Up to now, I didn't find a solution to align text in the middle of a inline neither block box in the vertical direction. That's because the vertical-align property is not active for many...
14
by: jlemay | last post by:
if you look at http://www.emrose.net/contact1.html the last field is a textarea field and I can't make it align with the other text fields. it's pretty close, but this comes from trial and...
6
by: DM | last post by:
Is there any way to left align the text in a server control button?
3
by: tshad | last post by:
I have the following: <tr valign="baseline"> <td align="center" width="103" colspan=2 nowrap> <asp:Button ID="ViewPositions" runat="server" Text="View Positions" OnClick="ViewPositions_Click"...
5
by: Yohan Blurp | last post by:
Hi, Here is sample page to show you the problem : <html><body> <form action="/cgi-bin/test.cgi" method="post"> Data Path : <input type="text" size="50" value="C:\Test Data\May 2007.xls"...
6
shane3341436
by: shane3341436 | last post by:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta...
5
by: Max2006 | last post by:
Hi, I have a TreeView and this is my node style: <asp:TreeNodeStyle ForeColor = "#000000" Font-Size="9px" Font-Bold="false" Width="100px" NodeSpacing="3px" /> The problem is the expand...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.