Jump to content

[SOLVED] Help with lining up HTML form elements


Darkmatter5

Recommended Posts

I have the following code

<label for='firstname'>Name: </label><br>
<span><input type='text' name='firstname' value='$row[mem_firstname]'><br><label for='firstname' style='font-size: 10px; font-weight: normal;'>First</label></span>
<span><input type='text' name='lastname' value='$row[mem_lastname]'><br><label for='lastname' style='font-size: 10px; font-weight: normal;'>Last</label></span>

 

This current code produces something like this.

Name:

"firstname text box"

First "lastname text box"

Last

 

I'm wanting it to be like this.

Name:

"firstname text box" "lastname text box"

First                      Last

 

How might I do this?

Link to comment
Share on other sites

<label for='firstname'>Name: </label><br>
<div style='float:left;'>
  <input type='text' name='firstname' value='$row[mem_firstname]'><br>
  <label for='firstname' style='font-size: 10px; font-weight: normal;'>First</label>
</div>
<div style='float:left;'>
  <input type='text' name='lastname' value='$row[mem_lastname]'><br>
  <label for='lastname' style='font-size: 10px; font-weight: normal;'>Last</label>
</div>
<div style="clear:left;"></div>

Link to comment
Share on other sites

Okay that worked, but now surprisingly Firefox is giving me a problem that IE isn't.  Here's my code and attached is a screen shot of each browser rendering.  I HATE to say this, but I would like for Firefox to render like IE.

 

<label for='username'>Username:</label>
<div><input type='text' name='username' value='$row[mem_username]'></div><p>
<label for='firstname'>Name:</label>
<div style='float: left;'>
  <input type='text' name='firstname' value='$row[mem_firstname]'><br>
  <label for='firstname' style='font-size: 10px; font-weight: normal;'>First</label>
</div>
<div style='float: left;'>
  <input type='text' name='lastname' value='$row[mem_lastname]'><br>
  <label for='lastname' style='font-size: 10px; font-weight: normal;'>Last</label>
</div>
<div style='clear: left;'></div><p>
<label for='email'>Email:</label>
<div><input type='text' name='email' value='$row[mem_email]'></div><p>
<label for='theme'>Prefered page theme:</label>
<div><input type='text' name='theme'></div><p>
<label for='zipcode'>Zipcode:</label>
<div><input type='text' name='zipcode' value='$row[zipcode]'></div>

 

Notice the distance between labels and the divs below in Firefox. I don't want that distance.

 

[attachment deleted by admin]

Link to comment
Share on other sites

<div style='margin-bottom: 10px;'>
  <label for='username'>Username:</label>
  <div><input type='text' name='username' value=''></div>
</div>
<div style='margin-bottom: 10px;'>
  <label for='firstname'>Name:</label><br />
  <div style='float: left;'>
    <input type='text' name='firstname' value=''><br>
    <label for='firstname' style='font-size: 10px; font-weight: normal;'>First</label>
  </div>
  <div style='float: left;'>
    <input type='text' name='lastname' value=''><br>
    <label for='lastname' style='font-size: 10px; font-weight: normal;'>Last</label>
  </div>
  <div style='clear: left;'></div>
</div>
<div style='margin-bottom: 10px;'>
  <label for='email'>Email:</label><br />
  <input type='text' name='email' value=''>
</div>
<div style='margin-bottom: 10px;'>
  <label for='theme'>Prefered page theme:</label><br />
  <input type='text' name='theme'>
</div>
<div style='margin-bottom: 10px;'>
  <label for='zipcode'>Zipcode:</label><br />
  <input type='text' name='zipcode' value=''>
</div>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.