I am trying to put a status image (showing a tick if email is correct or cross if not) next to the email field in my form.
The problem is my registration form is using the table method , so the image is not showing next to the field but below it. Can anyone help me out here?
This is what I tried to do but still not work the way I want it to.
<table width="500" border="0">
<tr><td width="210" height="45">Email:</td><td>
<input type="text" size="40" name="userEmail" id="userEmail" onkeyup="checkEmail(this.value);" onblur="checkEmail(this.value);" maxlength="60" />
**<img id="status" src="images/bad.png" style="margin-left:5px; vertical-align:middle;" alt="Status" /></td></tr>**
</table>
The issue is because the <td> has not enough space to fit in both text field and the image.
either add more width to the <table> or the 2nd <td> will solve the problem.
Since your image is of a check mark and an x, just use the unicode equivalents:
✔ = ✔
✘ = ✘
And simply get rid of the image altogether.
All it needs right now is space to fit in.
<table width="650px" border="0">
<tr><td width="210px" height="45">Email:</td><td>
<input type="text" size="40" name="userEmail" id="userEmail" onkeyup="checkEmail(this.value);" onblur="checkEmail(this.value);" maxlength="60" />
**<img id="status" src="https://www.google.ca/images/srpr/logo4w.png" width="125px" height="50px" style="margin-left:5px; vertical-align:middle;" alt="Status" /></td></tr>**
</table>
Take a look at this fiddle, what changed is the size of the table containing the column. You may either reduce the input width or let it more space by increasing the table width.
Related
I have this issue. I have written this HTML code, but I am unable to align between the question, yes/no buttons and text area box. My question has huge space from yes/no buttons, but when I drag the text area box and making it smaller, the question and yes/no buttons come closer as I wanted it to look. How can I fix this issue so my question is next to the yes/no buttons and box is underneath and doesn't move when I drag to make it bigger or smaller?
<table cellspacing="2" cellpadding="2">
<tr>
<td class="data_yy">
<input type="radio" name="jack" id="jack" value="Y" onclick="hideShowJacks('Y');"/><label>Yes</label>
<input type="radio" name="jack" id="jack" value="N" checked onclick="hideShowJacks('N');"/><label>No</label>
</td>
<td class="data_xx"> Are are taking English class in fall?</td>
</tr>
<tr>
<td>
<textarea cols="120" rows="5" maxLenghth="20" class="resizable" name="jack" id="jack"> </textarea>
<div class="plaintext" style="justify:left" id="jack"> </div>
</td>
</tr>
</table>
So, this is a table, and you have two cells in the first row, and only one cell in the second row. You'll want that second cell to have colspan="2" as a property...
<td colspan="2">
And then, for the second part of your issue ("so my question [text] is next to the yes/no buttons"), you'll want to change the first yes/no cell to have <nobr> so it doesn't linebreak, and also set width="1"...
<td class="data_yy" width="1">
Made a quick working demo.
Does this look right?
Looking for a quick easy way to Add Text on top of a pic as a user fills in fields on a form.
I am trying to create an order form for a Brick Design Project I am running and this is driving me crazy.
I am trying to keep it simple as I am just trying to learn styling and coding through CSS3 and HTML5.
<table>
<tr>
<td>
<br />
<br />
<br />
<br />
<label for="Line1">Line1:</label>
<input id="Line1" name="Line1" value="" maxlength="18">
<br />
<br />
<label for="Line2">Line2:</label>
<input id="Line2" name="Line2" value="" maxlength="18">
<br />
<br />
<label for="Line3">Line3:</label>
<input id="Line3" name="Line3" value="" maxlength="18">
<br />
<br />
</td>
<td>
</td>
</tr>
<tr>
<td><img src="paver.jpg" width="100%" height="100%" border="2" alt="" /> [Line1]
</br>[Line2]</br>[Line3]</br>
</td>
<td>
<input type="reset" value="Reset Values">
<br />
</td>
<td>
<input type="submit" value="Quick View">
</td>
</tr>
In properly used HTML5 and CSS3, the main thing is to separate presentation from content.
-> Content: goes into the HTML.
So you have a from, labels, input fields, some buttons
You do not have a table! (when looking at content)]
-> layout (presentation) goes into the CSS
Here you would have sizes, positionining, colors, background images, etc.
Now your image you want behind your form: it's hard to tell up front this has to be presentation (I'd guess in 99% of cases it would be), but it could be argued otherwise in more rare cases.
Once you have this separated, how it looks is mere CSS, and in CSS putting things over one another or using background images etc. is all pretty much a piece of cake.
So what do you want to end up with?
HTML:
a form!
a fieldset (optional)
the input fields (they need atype AFAIK)
Try to avoid any and all that's just there for how it looks.
CSS:
Everything needed to make it look like what you seek to have
(but you currently have nothing, so it's kinda hard to nudge you in the right direction)
I'd suggest a good tutorial.
Ref: (these contain a lot more detail and examples)
https://www.w3.org/TR/html5/forms.html
https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Styling_HTML_forms
I was maintaining a very old web project and found issues with the alignment. It seems to be very simple HTML or CSS issues, but I couldn't figure it out.
The app generates two tables in the code behind(populates the contents of the second table) and stacks them up like this:
<table border="1">
<tr>
<td width="70%" align="center">Description</td>
<td width='75px'>Header1</td>
<td width='75px'>Header2</td>
<td width='75px'>Header3</td>
</tr>
</table>
<table border="1">
<tr>
<td width='70%'>
<input type="text" name="first_name" value="Software" style="width:100%" />
</td>
<td width='75px'>
<input type="text" value="2000" style="width:100%" />
</td>
<td width='75px'>
<input type="text" value="1" style="width:100%" />
</td>
<td width='75px'>
<input type="text" value="2" style="width:100%" />
</td>
</tr>
</table>
The first table serves as the header while the second table contains the detail rows.So each header should align properly with its content. But when I resize the window, the alignment is messed up.
I just wondering why it happens as the tables follow the same structure. The only difference is the second table uses some input elements instead of plain text.
That's how tables work. The content of the first table is too big to shrink the table cells as much as the 2nd table. A quick check is to change the text in the first table, see this fiddle for instance: https://jsfiddle.net/q4zzvcra/
Also, td width="75px" needs to be td width="75" ditch the px
In html 5 width is not supported anymore for td, use css instead, see this post: HTML 'td' width and height
I tried this out at https://jsfiddle.net/9p37p2en/.
The only difference is the second table uses some input elements instead of plain text.
And that's exactly your problem. The text nodes will never shrink beyond the minimum width of the longest word, so unless you get rid of the overflow in your table, your table cell won't shrink smaller than that. An text INPUT field however can shrink until just a few px.
Also:
Absolute widths in table cells are ignored if in that same table there are cells with relative width. You can safely remove the width=75px, it doesn't do anything at all.
You should not use td's width and align properties. Use its style or class property instead together with the correct CSS.
I've got a form inside a table that has some Javascript validation. The table tag is
<table style="padding-left:70px" align="left" cellpadding="10">
and a given row looks like this:
<tr id="email_row">
<td align="right" valign="top">
<label for="email">Email: *</label>
</td>
<td class="field_cell" valign="top">
<input type="text" name="email" maxlength="80" size="30"><span class="error_field"></span>
</td>
</tr>
If the user hits submit without this or other fields filled (or filled correctly), the span gets filled with an error message like "Invalid" or "Required." Unfortunately, doing this shifts the whole tbody over do the left (even though it is aligned left). Any suggestions?
FYI, I can only reproduce this problem in Chrome. Firefox and IE are working just fine.
Fixed!
The problem was that I had a row of text in the table with colspan=2 that made the width of the table greater than the width of any of the other rows.
Adding text to the <span> elements increased the width of the second column, which in turn caused the first column to become smaller (since its cells were aligned to the right).
I have a table which has two text boxes and an image beside it to click and open a popup.
In read-only mode based on condition I am able to make text boxes read-only but images are not becoming read-only. One solution I had is the anchor tag associated with image calls for JavaScript where I can check for a dummy click when it is in read-only mode. The problem here is the function is common and affects everywhere. So is there a way to make the entire table read-only so that no extra workaround needs to done?
Edited for code
<table>
<tr>
<td class="lightbg" colspan='4'>
Expires:<input type="TEXT" value="" id="element1" name="expireDate" size="10" maxlength="20" class="" onChange="javascript:validateDateEntry('element1',true);;">
Period:<input type="TEXT" value="" id="element2" name="refershDate" size="10" maxlength="20" class="" onChange="javascript:validateDateEntry('element2',true);;">
<a href="javascript:doCalendar('element1');">
<img src="/PWM/images/images_2006/calendarbtn.gif" border="0" alt="Click to select date from calendar" align="absmiddle">
</a>
</td>
</tr>
<tr>
<td colspan='4'><b>*</b>Times are in the WFM Server's Time Zone.</td></tr>
</table>
An img is always readonly in html.
If you want to prevent the link from being clicked, you can do that in javascript.
jQuery example:
$('table a').click(function(event){
event.preventDefault();
});