/    Sign up×
Community /Pin to ProfileBookmark

In the attached file you can see I can’t align the button to the text field… Any ideas? I want them to be horizontally aligned… When I test it on different browsers the button sits slighlty below…

[upl-file uuid=9b3bef7f-14e6-4472-bdd0-66fc4168839b size=2kB]button.zip[/upl-file]

to post a comment
HTML

5 Comments(s)

Copy linkTweet thisAlerts:
@mooiSep 21.2006 — I would suggest putting a table around it so that the textfield is in one column and the button is in another, for example:
[code=html]<table cellpadding="0" cellspacing="0">
<tr>
<td><input name="textfield22" type="text" size="12" /></td>
<td><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('go_but1','','images/go_but_1.gif',1)"><img src="images/go_but_0.gif" alt="GO" name="go_but1" width="23" height="19" border="0" align="middle" id="go_but1" /></a></td>
</tr>
</table>[/code]


I know it requires a bit more code, but it's better than playing around with the margins etc of the buttons. Plus this is a solution that should work in all browsers.

?
Copy linkTweet thisAlerts:
@felgallSep 21.2006 — Don't use a table as it isn't tabular data.

Alignment should be handled by floating elements from your stylesheet.
Copy linkTweet thisAlerts:
@mooiSep 21.2006 — Technically it's not tabular data but for layout sake it is a more efficient solution. Using CSS hacks to make it the same on different browsers would it too complicated for such a simple problem.
Copy linkTweet thisAlerts:
@tomyknokerauthorSep 21.2006 — So could someone show me how to do it? With my expample as I'm a little lost...
Copy linkTweet thisAlerts:
@KravvitzSep 21.2006 — Like I said on HTMLForums, you should try using the [url=http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align]vertical-align[/url] and [url=http://www.w3.org/TR/CSS21/box.html#propdef-margin]margin[/url] properties to align them.
×

Success!

Help @tomyknoker spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...