Please run the code snippet below and explain why the "Hey There" Text is not aligned with the "Sign Up!" text?
That is the code I used to create the table.
<div style="width: 800px; margin: 0px auto 0px auto;">
<table>
<tr>
<td width="60%" vallign="top">
<h2>Hey There</h2>
</td>
<td width="40%" vallign="top">
<br />
<br />
<h2>Sign up!</h2>
<br />
<br />
<form action="#" method="POST">
<input type="text" name="fname" size="25" placeholder="First Name" />
<br />
<br />
<input type="text" name="fname" size="25" placeholder="Last Name" />
<br />
<br />
<input type="text" name="fname" size="25" placeholder="E-mail" />
<br />
<br />
<input type="text" name="fname" size="25" placeholder="Password" />
<br />
<br />
<input type="submit" name="submit" value="Submit">
</form>
</td>
</tr>
</table>
</div>
They are not aligned for two reasons:
the vallign is not an attribute. Change it to valign
you have two line breaks <br /> above your "Sign Up!" text. Either
remove them, or add them above your <H2>Hey There</H2> text.
See my example below:
<div style="width: 800px; margin: 0px auto 0px auto;">
<table>
<tr>
<td width="60%" valign="top">
<h2>Hey There</h2>
</td>
<td width="40%" valign="top">
<h2>Sign up!</h2>
<br />
<br />
<form action="#" method="POST">
<input type="text" name="fname" size="25" placeholder="First Name" />
<br />
<br />
<input type="text" name="fname" size="25" placeholder="Last Name" />
<br />
<br />
<input type="text" name="fname" size="25" placeholder="E-mail" />
<br />
<br />
<input type="text" name="fname" size="25" placeholder="Password" />
<br />
<br />
<input type="submit" name="submit" value="Submit">
</form>
</td>
</tr>
</table>
</div>
It's because the way you have your table structured, you have one row and two columns.
Text is automatically centered vertically, so it's not lining up correctly. You have 2 options:
Either have a table that is 2x2 with the top row containing your h2's "Hey There" and "Sign Up". Try this:
<div style="width: 800px; margin: 0px auto 0px auto;">
<table>
<tr> <!--top row -->
<td width="60%">
<h2>Hey There</h2>
</td>
<td width="40%">
<br />
<br />
<h2>Sign up!</h2>
<br />
<br />
</td>
</tr>
<tr> <!-- Bottom row with form -->
<td>
<!-- Empty to make a 2x2 table -->
</td>
<td>
<form action="#" method="POST">
<input type="text" name="fname" size="25" placeholder="First Name" />
<br />
<br />
<input type="text" name="fname" size="25" placeholder="Last Name" />
<br />
<br />
<input type="text" name="fname" size="25" placeholder="E-mail" />
<br />
<br />
<input type="text" name="fname" size="25" placeholder="Password" />
<br />
<br />
<input type="submit" name="submit" value="Submit">
</form>
</td>
</tr>
</table>
</div>
Get rid of your <br /> tags in the cell where you have "Sign Up!" and give your <td> tags an additional styling of vertical-align: top. This will change the vertical alignment from being centered to aligning to the top so your headers will line up.
A table by defaults aligns vertically at the middle, the solution to that problem is to align at the top so that both the signup and hey there text can be on the same level using css instead of html
add this code in the header section to affect all tables
<style>
table, th, td {
vertical-align: top;
}
</style>
Please try This.
<div style="width: 800px; margin: 0px auto 0px auto;">
<table>
<tr>
<td width="60%" vallign="top">
<h2>Hey There</h2>
</td>
</tr>
<tr>
<td width="40%" vallign="top">
<br />
<br />
<h2>Sign up!</h2>
<br />
<br />
<form action="#" method="POST">
<input type="text" name="fname" size="25" placeholder="First Name" />
<br />
<br />
<input type="text" name="fname" size="25" placeholder="Last Name" />
<br />
<br />
<input type="text" name="fname" size="25" placeholder="E-mail" />
<br />
<br />
<input type="text" name="fname" size="25" placeholder="Password" />
<br />
<br />
<input type="submit" name="submit" value="Submit">
</form>
</td>
</tr>
</table>
</div>
Reason: You actually forgot the ending of </tr>.
That's because it is basic html. You will need to work on CSS. I would recommend to use bootstrap.
<div class="row">
<div class="col-md-3">
<h2> Hey There</h2>
</div>
<div class="col-md-3">
<table>
<tr>
<h2>Sign up!</h2><br /><br />
<form action= "#" method="POST">
<input type="text" name="fname" size="25" placeholder="First Name" /><br /><br />
<input type="text" name="fname" size="25" placeholder="Last Name" /><br /><br />
<input type="text" name="fname" size="25" placeholder="E-mail" /><br /><br />
<input type="text" name="fname" size="25" placeholder="Password" /><br /><br />
<input type="submit" name="submit" value="Submit">
</form>
</td>
</tr>
</table>
</div>
</div>
Hope this works for you!
Related
I have a form I'm looking to place an image behind, like in this example:
The code is as follows:
#minicontact{width:25%;float:right;margin:-525px 155px -5px 0;}
#miniformtitle{margin:0 auto; text-align:center;}
#buttonmini{cursor:pointer;width:150px !important;height:60px !important;font-size:120% !important;text-align:center !important;background-color:#6db9fa !important;color:#ffffff !important;border-radius:20px !important; margin-top:20px; display:block; padding:0px;
margin:0 auto;}
<div id="minicontact">
<h3 id="miniformtitle">Get Started</h3>
<form class="contact" action="<?=$_SERVER['REQUEST_URI'];?>#cform1" method="post" name="simp_cont">
<p><br /> <input id="captcha" class="input" style="position: absolute; left: -9999px;" name="captcha" type="text" /><br /> <input id="name" name="fname" type="text" placeholder="NAME" /><br /> <input id="phone" name="phone" type="text" placeholder="PHONE NUMBER"
/><br /> <input id="email" name="email" type="text" placeholder="EMAIL ADDRESS" /><br /> <input id="footage" name="footage" type="text" placeholder="ESTIMATED SQUARE FOOTAGE" /><br /> <textarea class="textarea" name="message" placeholder="COMMENTS"></textarea><input name="form_name" type="hidden" value="contact_form" />
<button type="submit" id="buttonmini" name='submit'>SEND MESSAGE</button></p>
</form>
</div>
The image I'm trying to use as the background is:
Google probably won't allow you to see the image in run script, but the CSS is there for you to achieve it :)
#minicontact {
width:400px;
height:500px;
float:left;
border:1px solid #ebebeb;
background:url('https://cdn.pixabay.com/photo/2016/10/27/22/53/heart-1776746_1280.jpg');
background-size:cover;
background-position:center;
}
<div id="minicontact">
<h3 id="miniformtitle">Get Started</h3>
<form class="contact" action="<?=$_SERVER['REQUEST_URI'];?>#cform1" method="post" name="simp_cont">
<p><br /> <input id="captcha" class="input" style="position: absolute; left: -9999px;" name="captcha" type="text" /><br /> <input id="name" name="fname" type="text" placeholder="NAME" /><br /> <input id="phone" name="phone" type="text" placeholder="PHONE NUMBER"
/><br /> <input id="email" name="email" type="text" placeholder="EMAIL ADDRESS" /><br /> <input id="footage" name="footage" type="text" placeholder="ESTIMATED SQUARE FOOTAGE" /><br /> <textarea class="textarea" name="message" placeholder="COMMENTS"></textarea><input name="form_name" type="hidden" value="contact_form" />
<button type="submit" id="buttonmini" name='submit'>SEND MESSAGE</button></p>
</form>
</div>
Just set a background image via css, and you're good to go.
https://developer.mozilla.org/en-US/docs/Web/CSS/background-image
Trying to get the input fields of my html to align up with the other input fields.
Is there a way to make it aligned without using CSS?
This is what I have :
Name:|-----Input-------|
Password:|-----Input-------|
Confirm password:|-----Input-------|
Email:|-----Input-------|
Phone:|-----Input-------|
Trying to make it like this:
Name:.....................|-----Input-------|
Password:..............|-----Input-------|
Confirm password:|-----Input-------|
Email:.....................|-----Input-------|
Phone:...................|-----Input-------|
(without the dots)
Code:
<form>
<label>Name:</label>
<input type="text" name="namefield" align="center"> <br />
<label><br>Password: </label>
<input type="password" name="pwdfield"> <br />
<label><br>Confirm password: </label>
<input type="password" name="cpwdfield"> <br />
<label><br>Email: </label>
<input type="email" name="email"> <br />
<label><br>Phone: </label>
<input type="tel" name="phone"> <br />
<br>
<input type="submit" value="Register" />
</form>
Using the table tag without borders allows one to align textboxes without css.
<FORM>
<TABLE frame="box">
<TR><TD>Your name</TD> <TD><INPUT TYPE="TEXT" NAME="name" SIZE="25"></TD> </TR>
<TR><TD>Password</TD> <TD><INPUT TYPE="TEXT" NAME="pwdfield" SIZE="25"></TD> </TR>
<TR><TD>Confirm password</TD> <TD><INPUT TYPE="TEXT" NAME="cpwdfield" SIZE="25"></TD> </TR>
<TR><TD>E-mail</TD> <TD><INPUT TYPE="TEXT" NAME="email" SIZE="25"></TD> </TR>
<TR><TD>Phone</TD> <TD><INPUT TYPE="TEXT" NAME="phone" SIZE="25"></TD> </TR>
</TABLE>
<P><INPUT TYPE="SUBMIT" VALUE="Register" NAME="B1"></P>
</FORM>
my question is how to control fill entries in textfield.
http://support.mozilla.org/en-US/kb/control-firefox-automatically-fills-in-forms
In my app I have page with login form which have username textField. Then I have registration page with email textField. Now I have problem that firefox rember entries which I enter to username textField also in email textField. But when I enter value to email textField firefox does rember it. Same with chrome browser
form1
<form wicket:id="signInForm">
<table>
<tr>
<td align="right"><wicket:message key="username">
Username
</wicket:message></td>
<td><input wicket:id="username" type="text" /></td>
</tr>
<tr>
<td align="right"><wicket:message key="password">
Password
</wicket:message></td>
<td><input wicket:id="password" type="password" /></td>
</tr>
<tr wicket:id="rememberMeRow">
<td></td>
<td><input wicket:id="rememberMe" type="checkbox" /> Remember
Me</td>
</tr>
<tr>
<td></td>
<td><input class="tournamentButton" type="submit"
wicket:id="signIn" value="Sign In" /> <input class="tournamentButton"
type="reset" value="Reset" /> <input class="tournamentButton"
type="submit" wicket:id="register" value="Register" /></td>
</tr>
</table>
</form>
form2
<form class="userform" wicket:id="userEditForm">
<fieldset>
<legend>
<wicket:message key="user">
User
</wicket:message>
</legend>
<div>
<label wicket:for="name"><wicket:message key="name">
Name:
</wicket:message></label><input type="text" wicket:id="name" />
</div>
<div>
<label wicket:for="surname"><wicket:message key="surname">
Surname:
</wicket:message></label><input type="text" wicket:id="surname" />
</div>
<div>
<label wicket:id="userNameLabel" /> <input type="text"
wicket:id="userName" />
</div>
<div>
<label wicket:for="email"><wicket:message key="email">
Email:
</wicket:message></label><input type="email" wicket:id="email" />
</div>
<div>
<label wicket:for="password"><wicket:message key="password">
Password:
</wicket:message></label><input type="password" wicket:id="password" />
</div>
<div>
<label wicket:for="confirmPassword"><wicket:message
key="confirmPassword">
Confirm Password:
</wicket:message></label><input type="password" wicket:id="confirmPassword" />
</div>
<div>
<label wicket:id="platnostLabel" /> <input type="text"
wicket:id="platnost" />
</div>
<div>
<label wicket:id="roleLabel" /><input type="text" wicket:id="role" />
</div>
</fieldset>
<div>
<input class="tournamentButton" type="submit" wicket:id="submit"
value="Save" /> <input class="tournamentButton" type="submit"
wicket:id="back" title="back" value="Back" />
</div>
</form>
In your HTML add the attribute autocomplete="off" to input fields where you dont want browsers to remember that information. For example:
<input type="text" autocomplete="off" wicket:id="userName" />
EDIT: 02.2018:
Browser behavior changed over time and now for login and password fields autocomplete off is not supported in modern browsers:
https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion#The_autocomplete_attribute_and_login_fields
I am new to HTML alignment. I have three input fields but they are not properly aligned.
<form>
username:<input type="text" name="username" value="ENTER NAME HERE" /><br>
id:<input type="text" name="id" value="ENTER ID HERE" /><br>
age:<input type="text" name="age" value="ENTER AGE HERE" />
</form>
Please help me align using colspan or rowspan so the input fields look good one below the other.
Try this..
It's work properly as HTML alignment vise
<form>
<div style="width:300px">
<div style="float:left">username:</div><div style="float:right"><input type="text" name="username" value="ENTER NAME HERE" /></div><br>
<div style="float:left">id:</div><div style="float:right"><input type="text" name="id" value="ENTER ID HERE" /></div><br>
<div style="float:left">age:</div><div style="float:right"><input type="text" name="age" value="ENTER AGE HERE" /></div>
</div>
</form>
Try this:
<div id="userdata">
<div><label>Enter Name</label><input type="text" /></div>
<div><label>Enter Id</label><input type="text" /></div>
<div><label>Enter Age</label><input type="text"/></div>
</div>
Use them in a table:
<div id="userdata">
<table>
<tr>
<td>Enter Name</td><td><input type="text" /></td>
</tr>
<tr>
<td>Enter ID</td><td><input type="text" /></td>
</tr>
<tr>
<td>Enter Age</td><td><input type="text" /></td>
</tr>
</table>
</div>
This is my code so far:
<form>
<p>Username: </p><input type="text" name="username" />
<p>Password: </p><input type="text" name="password" />
<br /><input type="submit" value="Submit" />
</form>
For some interesting reason it is going to another line for ever paragraph and textbox. What can I do to prevent that?
Put your paragraph tags around the input also. The P tag basically does a line break at the end of itself.
<form>
<p>Username: <input type="text" name="username" /></p>
<p>Password: <input type="text" name="password" /></p>
<br /><input type="submit" value="Submit" />
</form>
Do this:
<form>
Username: <input type="text" name="username" />
<br/>
Password: <input type="text" name="password" />
<br /><input type="submit" value="Submit" />
</form>
or
<form>
Username:<br/> <input type="text" name="username" />
<br/>
Password:<br/> <input type="text" name="password" />
<br /><input type="submit" value="Submit" />
</form>
<form>
<div style="float: left;">Username: <input type="text" name="username" /></div>
<div style="float: left;">Password: <input type="text" name="password" /></div>
<div style="clear: both;"></div>
<input type="submit" value="Submit" />
</form>
They're dropping to a new line because of your markup. Paragraph (<p>) tags drop to a new line, as do breaks (<br>). I would suggest using <span> tags in place of the paragraph tags, and remove the line break.
p tag is by default "display: block" which means a <br /> before and after p is added by the browser, so is the reason it is going to the next line.
include both the label & textbox in "p"
<form>
<p>Username: <input type="text" name="username" /></p>
<p>Password: <input type="text" name="password" /></p>
<p><input type="submit" value="Submit" /></p>
</form>