3 replies [Last post]
alexnyc
Offline
newbie
New York
Last seen: 18 years 15 weeks ago
New York
Joined: 2004-10-21
Posts: 2
Points: 0

I am trying to align a text box and a button so that they are on the same line, but the button keeps going to the next line. The code looks like this:

<input type="text" size="10" class="textbox" />
<input type="button" value="OK" class="submit" style="float: right;"/>

Any ideas?

karinne
karinne's picture
Offline
Enthusiast
Aylmer, QC, Canada
Last seen: 15 years 32 weeks ago
Aylmer, QC, Canada
Timezone: GMT-5
Joined: 2004-01-14
Posts: 291
Points: 0

Align form elements

putting like this

<input type="text" size="10" class="textbox" /> <input type="button" value="OK" class="submit" />

it should stay on the same line!?

alexnyc
Offline
newbie
New York
Last seen: 18 years 15 weeks ago
New York
Joined: 2004-10-21
Posts: 2
Points: 0

Align form elements

Got it, thanks. There was a <DIV> around it that was not wide enough to let it stay on one line.

chris_sw
Offline
Enthusiast
Leeds, UK
Last seen: 18 years 19 weeks ago
Leeds, UK
Joined: 2004-09-21
Posts: 115
Points: 0

Align form elements

Hi Alex:

When you float an element, it means that subsequent elements will use any unused space around it. If you don't want them inline as in karinne's post, try floating the first element rather than the second one.