473,795 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Aligning FORM input objects?

I have two visible FORM input objects that i'd like to align next to
each other horizontally. However, the left side item is slightly lower
than the right. Is there any style I can apply that will keep them
aligned?

Here's the problem code:

<p><textarea name="comment" id="comment" cols="100%" rows="10"
tabindex="4"></textarea></p>

<p><input name="submit" type="submit" id="submit" tabindex="5"
value="Submit Comment" />
<input type="hidden" name="comment_p ost_ID" value="21" />
</p>
<input type="button" value="Preview" onclick="" />

You can see the full page here:
http://www.cygen.com/blog/index.php/...-my-wordpress/

Thanks,
Brett

Nov 11 '06 #1
4 2157
On 2006-11-11, brett <ac*****@cygen. comwrote:
I have two visible FORM input objects that i'd like to align next to
each other horizontally. However, the left side item is slightly lower
than the right. Is there any style I can apply that will keep them
aligned?
Your "Submit Comment" button is a right float, in its own <p>,
followed by the Preview button which starts a new anonymous block box.

The gap is formed by the bottom margin of that <pand the top margin of
the "Preview" button.

So if you add 'style="margin-bottom: 0;"' to the <paround the Submit
Comment button, and 'style="margin-top: 0' to the Preview <input>
element, the gap disappears and the buttons are aligned. You've already
set margins of 0 on the Submit Comment button in the stylesheet.

This is the quick fix, but maybe it would be less haphazard to put both
buttons in a single div (div is better than p here I think).

In other words:

<div>
<input name="submit" ...
<input value="Preview" ...
</div>

With one of the inputs floated right (which you have) and then set
margin on both of them to the same thing (currently you have margin: 0
on one of the inputs) which will line them up.

[snip]
You can see the full page here:
http://www.cygen.com/blog/index.php/...-my-wordpress/
Nov 11 '06 #2
<div>
<input name="submit" ...
<input value="Preview" ...
</div>

With one of the inputs floated right (which you have) and then set
margin on both of them to the same thing (currently you have margin: 0
on one of the inputs) which will line them up.
I've tried that but it is still not aligned:

<div style="margin: 0px">
<input name="submit" type="submit" id="submit" tabindex="5"
value="Submit Comment" />
<input type="button" value="Preview" onclick="" />
</div>

Where do you see the margin is set on one of them?

Thanks,
Brett

Nov 11 '06 #3
On 2006-11-11, brett <ac*****@cygen. comwrote:
><div>
<input name="submit" ...
<input value="Preview" ...
</div>

With one of the inputs floated right (which you have) and then set
margin on both of them to the same thing (currently you have margin: 0
on one of the inputs) which will line them up.

I've tried that but it is still not aligned:
Worked for me.
><div style="margin: 0px">
Never mind about the margins on this div. They're 0 anyway.
><input name="submit" type="submit" id="submit" tabindex="5"
value="Submit Comment" />
<input type="button" value="Preview" onclick="" />
</div>

Where do you see the margin is set on one of them?
IIRC your style sheet (style.css) sets margin: 0 on one of the buttons.
So either set margin: 0 on both of them, or leave them both alone.
Nov 11 '06 #4
Thanks a lot. I've corrected it.

Nov 12 '06 #5

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

Similar topics

3
2782
by: TekWiz | last post by:
I've got a system that automatically generates a form. I have it set up so that the backend will return to the inital form page with an error object in sessions data (assuming the backend detected invalid data or required fields not filled in) and the frontend will generate an initial value of items WITHOUT errors (so the user doesn't have to reenter valid info). This is the problem. The frontend generates the initial value attribute...
4
4298
by: Eric | last post by:
Hey Everyone.. I have a form that has approximately 7 text fields and 1 checkbox. Generally when this form is submitted(to itself BTW) it works fine, however, when the checkbox is only field that has been modified/clicked the form doesn't always submit. When it does work, a Stored procedure is passed form variables and updates to the db are made. When it doesn't, its as if the form wasn't submitted, it reloads and resets the page, but...
1
3843
by: junior | last post by:
Hi group, I have a problem with a small project i'm doing at the moment. Here's my code below. <table width="668" height="63" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="63" align="right" valign="middle" background="/xxxxx/xxx/plain.gif" style="height:63px; width:668px;
3
3217
by: Geoff Hague | last post by:
I've got a small little problem with my 'website-in-progress': http://www.captainsoftheworld.com/modernrepublic/strict/index.php http://www.captainsoftheworld.com/modernrepublic/strict/ModernRepublic.css Is it possible, without messing around with per-pixel positioning or sizing, to make the labels ("Name" & "E-mail") in the Mailing List form line up with their associated text-input areas? In my system's setup (using IE6) the labels...
1
2343
by: steve | last post by:
Hello, I'm reworking our company site, trying to do it without tables. It's been a bit of an... adventure. Site is starting to come along. Problem I've run into is aligning image input buttons with form elements. I'm sure there's an obvious reason but I can't figure out how to do so. Seems any image within the <form></form> are being bumped upward 4-6 pixels or so.
2
2140
by: skubik | last post by:
I'm curious as to whether it's possible to create a Form object and populate it with form element objects, strictly in Javascript, without the need to apply the form to a document. Essentially, I want to do this: tmpFormObj = new Form(); tmpFormObj.target = document.location; // For example. tmpFormObj.method = "POST";
3
5630
by: kk.simhadri | last post by:
Hi, I want to align some text to the bottom of page.I am doing this by a CSS class.It contains position:absolute; bottom:0; this does the purpose. but when I resize my page to smaller size, the text at the bottom overlaps my text written in the page above it.
2
2037
by: gubbachchi | last post by:
Hi all, I have a problem with css table. The code below works fine with firefox but the problem is with Internet explorer. This code actually fetches data from mysql database and display it in the form of table for which I have used CSS. In firefox the fetched are aligned properly but in Internet explorer, the width alignment is messed up. Here is the code I am using main.php <html> <head> <link href="main.css" rel="stylesheet"...
3
11962
by: Bram2 | last post by:
When putting a form on a webpage, I prefer the labels and edit boxes for all fields to be aligned, e.g. like this: http://i44.tinypic.com/6dvceo.png This is easily done by putting it all in a table. What is the best way to do this properly with CSS? Note: I don't want to define fixed widths for certain columns or whatever. The width for the labels should just be automatically as much as necessary to fit the widest label. I first...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3722
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.