/    Sign up×
Community /Pin to ProfileBookmark

Help! can’t align text inside form

Hi,
I’m a newbie here and need some serious help! I just started working on adding a form that includes Qty: with text input for the amount and a cart icon to my site (for e-commerce) and I can’t figure out for the life of me why i can’t align the text (Qty.) to the top of the cell/form. (see screen shot of problem below!)

Here’s my code:

<td align=”left” valign=”top” nowrap>
<form style=”margin-bottom:0;” method=post action=”https://www.mycartblahblah“>
<input type=hidden name=”PartNo” value=”001″>
<font face=”verdana” size=”1″>Qty:</font><input type=text name=”Qty” value=”1″ size=”1″ align=”top”>
<input name=”Submit” type=”image” src=”cart.gif” border=”0″ align=”top” alt=”add to cart” width=”21″ height=”19″>
</form>
</td>

The word Qty: is aligning in the center of the cell which looks awful with the rest of my table cells content which is left and top aligned. Any help would be appreciated. Thank you! Jill [IMG]http://www.autoperformancewarehouse.com/images/ScreenHunter_007.jpg[/IMG]

to post a comment
CSS

6 Comments(s)

Copy linkTweet thisAlerts:
@VladdyMay 26.2004 — Since you correctly posted the question to CSS forum, maybe you should start using CSS and leave prehistoric <font> behind.
Copy linkTweet thisAlerts:
@flatlanderauthorMay 26.2004 — Thanks - I totally agree, but i need some help! Any suggestions on re-working the code with only css style and aligning text to top?
Copy linkTweet thisAlerts:
@ray326May 26.2004 — Start out with the right markup.

<div>

<label for="Qty">Qty:&nbsp;</label>

<input type=text name="Qty" id="Qty" value="1" size="1">

</div>

Then style it up from there.
Copy linkTweet thisAlerts:
@flatlanderauthorMay 26.2004 — Hi,

thanks for the good start, although i've never used the <label> tag before. What does it mean and what does it do? what is the best way to add CSS now so that I can align my QTY text to the top of the cell? Thanks again - Jill
Copy linkTweet thisAlerts:
@FangMay 26.2004 — <label for="Qty" style="vertical-align:top;">
Copy linkTweet thisAlerts:
@ray326May 27.2004 — Since your example is so simple Fang's inline style will work fine. I prefer putting everything I can in a style sheet and keep the body mark up as simple as possible so up in the head of the page I'd have

<style type="text/css">

label { vertical-align: top; }

</style>
×

Success!

Help @flatlander 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.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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