473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Doctype affecting input field widths; fields extending past table boundaries

Hi, I am having trouble developing a form in a restricted environment. My sample code is found below my message (sorry I don't have a URL). Basically, without a doctype, the form displays properly with 3px padding around each form field, and no overlap. But the doctype changes the box model, I am told, and so the padding is added to the 100% width, leading to overlap and poor presentation. Unfortunately, I'm forced to use the doctype due to other content in the final page.

I was hoping there was a better workaround than assigning some arbitrarily smaller % to the width, like 98%, to accomodate the padding. Also, javascript would be out of the question (subtracting the padding in a dynamic way). You're my last hope!

Any info would be greatly appreciated. Also, this is a similar inquiry to this one: http://www.thescripts.com/forum/thread473949.html for referenc.

Thanks,
CB

Code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>

<!--
Ideally, I would like a 'global' solution here, in CSS
-->
<style>

.TextField {
width: 100%;
}

</style>

<body>



<br />
<table border="1" cellpadding="3" cellspacing="0" width="500" class="application_table">
<tr>
<td colspan="4" style="padding: 0px;" class="application_td">
<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tr>
<td width="40%" style="border: none;" class="application_td">Name &mdash; Last<br />
<span class="response"><input type="text" name="f_lastName" class="Global TextField QlastName RequiredField"></input></span>
</td>
<td width="35%" style="border: none;" class="application_td">First<br />
<span class="response"><input type="text" name="f_firstName" class="Global TextField QfirstName RequiredField"></input></span>
</td>
<td width="25%" style="border: none;" class="application_td">Middle<br />
<span class="response"><input type="text" name="f_middleName" class="Global TextField QmiddleName"></input></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="30%" class="application_td">Telephone (Area Code &amp; No.)<br />
<span class="response"><input type="text" name="f_telephone" class="Global TextField Qtelephone RequiredField"></input></span>
</td>
<td colspan="3" width="75%" class="application_td">Name used for previous education and/or employment, if other than current.<br />
<span class="response"><input type="text" name="f_otherName" class="Global TextField QotherName"></input></span>
</td>
</tr>
<tr>
<td colspan="4" style="padding: 0px;" class="application_td">
<table border="0" cellpadding="3" cellspacing="0" width="100%">
<tr>
<td width="40%" style="border: none;" class="application_td">Permanent Address &mdash; Street<br />
<span class="response"><input type="text" name="f_curStreet" class="Global TextField QcurStreet RequiredField"></input></span>
</td>
<td width="35%" style="border: none;" class="application_td">City<br />
<span class="response"><input type="text" name="f_curCity" class="Global TextField QcurCity RequiredField"></input></span>
</td>
<td width="5%" style="border: none;" class="application_select_bottom_padding">State<br />
<span class="response"><select name="f_curState" class="Global DropDown QcurState RequiredField"><option></option></select></span>
</td>
<td width="20%" style="border: none;" class="application_td">Zip Code<br />
<span class="response"><input type="text" name="f_curZip" class="Global TextField QcurZip RequiredField"></input></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="30%" rowspan="2" class="application_td" style="vertical-align: top;">Are you legally eligible to work in the U.S.?<br />
<span style="white-space: nowrap;"><span class="response"><span class="Global Radio QeligibleUS_yes RequiredField"><input type="radio" id="f_eligibleUS_yes" name="f_eligibleUS" value="f_eligibleUS_yes"></input></span></span> Yes</span>&nbsp;
<span style="white-space: nowrap;"><span class="response"><span class="Global Radio QeligibleUS_no RequiredField"><input type="radio" id="f_eligibleUS_no" name="f_eligibleUS" value="f_eligibleUS_no"></input></span></span> No</span><br />
</td>
<td colspan="3" width="70%" class="application_td" style="border-bottom: none;">Do you have any relatives employed by Company? &nbsp;
<span style="white-space: nowrap;"><span class="response"><span class="Global Radio Qrelatives_yes RequiredField"><input type="radio" id="f_relatives_yes" name="f_relatives" value="f_relatives_yes"></input></span></span> Yes</span>&nbsp;
<span style="white-space: nowrap;"><span class="response"><span class="Global Radio Qrelatives_no RequiredField"><input type="radio" id="f_relatives_no" name="f_relatives" value="f_relatives_no"></input></span></span> No</span><br />
</td>
</tr>
<tr>
<td width="28%" class="application_td" style="border-top: none; border-right: none;">Name<br />
<span class="response"><input type="text" name="f_relatives_name" class="Global TextField Qrelatives_name"></input></span>
</td>
<td width="22%" class="application_td" style="border-top: none; border-left: none; border-right: none;">Location<br />
<span class="response"><input type="text" name="f_relatives_loc" class="Global TextField Qrelatives_loc"></input></span>
</td>
<td width="20%" class="application_td" style="border-top: none; border-left: none;">Relationship<br />
<span class="response"><input type="text" name="f_relatives_relationship" class="Global TextField Qrelatives_relationship"></input></span>
</td>
</tr>
</table>


</body>
</html>
Jan 24 '07 #1
3 4787
drhowarddrfine
7,435 Expert 4TB
Try adding this to your css:

td{padding-right:7px}

You can use percent but that might be too big a jump between numbers.

Your style tag is incorrect. I should be <style type="text/css">
Jan 24 '07 #2
Try adding this to your css:

td{padding-right:7px}

You can use percent but that might be too big a jump between numbers.

Thanks a lot for the tip, but unfortunately this only halfway works. While many of the fields themselves are now within the table boundaries, any styles you may apply to the td inside are pushed to the right (in my case I lose 1/4 of my border because "stuff" is still outside of the td, even though it's just padding). In the box model, I think padding is added regardless of boundaries so what's inside is 100% plus padding... which isnt very intuitive imho but that's the way it goes, so it is wider than the surrounding element. I could do another workaround for that border issue but unfortunately it will only work for the far right edge of a multi-celled table, while the cells inside the table will still overlap and look bad.

Your style tag is incorrect. I should be <style type="text/css">
Sorry I put that together kind of sloppily, but the styles still apply.
Jan 24 '07 #3
drhowarddrfine
7,435 Expert 4TB
I've been playing with this and those nested tables are just gonna kill you. I would just use divs. You'll have so much more sensible control.
Jan 24 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Kai Grossjohann | last post by:
I would like to put a text input field (in the sense of <input type="text">) and an image next to each other, where I know the size in pixels of the image, and I know the total width in em. I...
5
by: Jonathan Daggar | last post by:
Hello, I'm trying to put together a form with a very tight table formatting. However, every time I put an text-type input field in, the browser pads the area to the right of it with space. I've...
9
by: Gary Holt | last post by:
We have a problem demonstrated by the following HTML document. To see the problem type HV in the first field then use the mouse cursor to click into the Staff code input box. You will find that...
12
by: Andrew Thompson | last post by:
I am developing a Periodic Table of the Elements as<DIV>s ..(chuckle - just kidding!) a <TABLE> at http://www.physci.org/test/chem/, or rather, the table itself is.....
5
by: Geoff Portbury | last post by:
I'm a swimming club coach. I have a data base for recording times at various meets. I have a FORM for entering times called SWIM TIMES. When I enter the swimmers name ID, eg FOR01 for Doug Ford I...
0
by: Chris Crowe | last post by:
Hi, I am using VB.net to export a table from a SQLServer2000 Database server. The table is basically a collection of fixed width char fields. Here's the issue: How do I get the fields, through...
50
by: Shadow Lynx | last post by:
Consider this simple HTML: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 STRICT//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head>...
5
by: Michael | last post by:
Hi. I need dinamically calculate input text field based on parent static TD before showing content of input. Please, advice. Michael
4
by: whamo | last post by:
I have the need to populate a field based on the selection in a combo box. Starting out simple. (2) tables tbl_OSE_Info and tbl_Input; tbl_OSE_Info has three fields: Key, OSE_Name and OSE_Wt...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.