popup at different position where the cursor clicks css - html

Here is my code:
<div class="checkbox">
<input id="230am" type="checkbox" onclick="openPopup()"> <label for="230am"></label>
<div id="popupBk">
<div id="title">Reminder</div>
<div id="timeSelect">
Start time: <input id="field1" /><br /><br />
End time: <input id="field2" /><br /><br />
</div>
<button onclick="processTime('field1','field2')" name="submit" id="submitButton"/>Create</button>
<div id="close_popup" title="Close this menu" onclick="closePopup()">
<p>X</p>
</div>
</div>
</div>
<div class="checkbox">
<input id="3am" type="checkbox"> <label for="3am"></label>
<div id="popupBk">
<div id="title">Reminder</div>
<div id="timeSelect">
Start time: <input id="field1" /><br /><br />
End time: <input id="field2" /><br /><br />
</div>
<button onclick="processTime('field1','field2')" name="submit" id="submitButton"/>Create</button>
<div id="close_popup" title="Close this menu" onclick="closePopup()">
<p>X</p>
</div>
</div>
</div>
Below are my css:
#popupBk{
position: absolute;
width: 25%;
height: 20%;
border: 2px solid grey;
border-radius: 2px;
background-color: white;
margin-left: 3%;
box-shadow: 2px 2px 10px;
display: none;
}
So I am trying to do a calendar app. I put two popup in two checkboxes just want to do that different popup will display under each checkbox once I click. Any ideas how to do this?
i think there is a way to make each class name differently and then create its own css, but if that it might needs a huge work. Or is there any other way?
Thanks.

You can use the :checked state of checkboxes in CSS, coupled with the general sibling selector (~) to do this.
Read about sibling selectors here: https://css-tricks.com/child-and-sibling-selectors/
Here's a live example:
.wrapper {
float: left;
}
.hidden {
border: 1px solid #000;
display: none;
}
input[type="checkbox"]:checked ~ .hidden {
display: block;
}
<div class="wrapper">
<input type="checkbox" id="box1" /> <label for="box1">Show Box 1</label>
<div class="hidden">Box 1</div>
</div>
<div class="wrapper">
<input type="checkbox" id="box2" /> <label for="box2">Show Box 2</label>
<div class="hidden">Box 2</div>
</div>

Related

How to arrange html label and input side by side

I have this few line of html code i want to arrange the label and input side by side with the label on top of the input with css but am not able to work around it. I found similar question herewhich suggest use of display:inline-block; to achieve that but after including it in my code an not able to do it.
body {
background-color: red;
}
input[type=text] {
border: 2px solid black;
border-radius: 4px;
margin-left: 150px;
display: inline-block;
clear: both;
}
input[type=number] {
border: 2px solid black;
border-radius: 4px;
margin-left: 150px;
display: inline-block;
clear: both;
}
<div id=tk>
<form action="" , method="">
<div id="styleform">
<label for="NAME">&nbsp&nbsp FIRST NAME</label></br>
<input type="text" id="NAME" size="20"></br>
</br>
<label for="no">&nbsp&nbsp NUMBER</label></br>
<input type="number" id="no" , size="45"></br>
</br>
<label for="age">&nbsp&nbsp AGE</label></br>
<input type="number" id="age" size="45"></br>
</br>
<label for="S_NO:">&nbsp&nbsp CODE</label></br>
<input type="text" id="S_NO:" size="20"></br>
</br>
</div>
</form>
</div>
I think this kind of easy question for some of you this new be in web development
This how i want it to look like
UPDATE
Updated fiddle after image provided
#LAS You are inserting line breaks, that is part of the problem. I have created this fiddle, fixing several things: https://jsfiddle.net/Lu5k1yk8/6/
Added ; after your spaces
fixed the line breaks (I believe the syntax should be <br> or <br />, not </ br> and removed them after labels
Changed your CSS for the textboxes to inline-table
Increased width of labels so they do not create new lines
Also, I would suggest not using spaces (nbsp;) or <br />'s and instead using CSS to create the correct spaces and line breaks.
Here is a good demonstration of how to use padding and margins: http://www.digizol.com/2006/12/margin-vs-padding-css-properties.html
Just remove br tag and add this to your code
input[type="text"] + label {
display: inline;
}
I think the best way is to take the label and input in a table.enter code here<table>
<tr><th>label</th><td><input type="text"></td></tr></table>
I changed your code a bit, I hope this is what you are looking for:
I set label into an inline-block element and set its min-width to 150px, and removed the margin-left: 150px;.
Also, if you use &nbsp, you need to add a semicolon at the end of it: , and with the </br> you need to add the slash at the end: <br />
body{
background-color: red;
}
label {
display: block;
min-width: 150px;
}
.test {
display: inline-block;
width: 45%;
background-color: white;
border: solid 1px blue;
padding: 5px 10px;
}
input[type=text] {
border: 2px solid black;
border-radius: 4px;
display: inline-block;
clear: both;
}
input[type=number] {
border: 2px solid black;
border-radius: 4px;
display: inline-block;
clear: both;
}
<div id=tk>
<form action="", method="">
<div id="styleform">
<div class="test">
<label for="NAME" >FIRST NAME</label>
<input type="text" id="NAME" size="20"><br /><br />
</div>
<div class="test">
<label for="no" >NUMBER</label>
<input type="number" id="no", size="45"><br /><br />
</div>
<div class="test">
<label for="age" >AGE</label>
<input type="number" id="age" size="45"><br /><br />
</div>
<div class="test">
<label for="S_NO:" >CODE</label>
<input type="text" id="S_NO:" size="20"><br /><br />
</div>
</div>
</form>
</div>
**EDIT: ** I have changed the code. Hope this helps you this time ;)
Hope this helps.
Do you mean something like this?
.block {
display: block;
}
.inline-block {
display: inline-block;
width: 49%;
}
body {
padding: 10px;
}
<div id=tk>
<form action="" method="">
<div id="styleform">
<div class="inline-block">
<label class="block" for="NAME">FIRST NAME</label>
<input class="block" type="text" id="NAME" size="20">
</div>
<div class="inline-block">
<label class="block" for="no">NUMBER</label>
<input class="block" type="number" id="no" , size="45">
</div>
<div class="inline-block">
<label for="age" class="block" >AGE</label>
<input type="number" class="block" id="age" size="45">
</div>
<div class="inline-block">
<label class="block" for="S_NO:">CODE</label>
<input type="text" class="block" id="S_NO:" size="20">
</div>
</div>
</form>
</div>

Border Disappears on Zoom Out/in In all Browser

I am working on a project with different browsers.
I am having a table with borders and when I zoom out my page border disappears.
This happens in all browsers like IE, EDGE, and Chrome Browser.
Is it the DOM structure problem?
It needs to supports with zoom level 75% to 125%. To be specific set zoom to 67% in Chrome and see the change
Please provide the possible solution to this question.
.mEditor {
display: flex;
border-bottom: 1px solid #d7d7d7;
}
.m-label {
width: 30%;
display: flex;
background-color: #f2f2f2;
}
.m-editor-noc {
flex: 1;
display: flex;
background-color: #FFFFFF;
border-left: 1px solid #d7d7d7;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.mfEditor {
display: flex;
flex: 1 0 auto;
}
.mEditor-li {
vertical-align: middle;
border-left: 1px solid #d7d7d7;
height: 18px;
display: inline-block;
margin-top: 3px;
}
.mEditor .tEditor {
border: none;
flex: 1;
padding-right: 6px;
}
<div class="m-group">
<div id="id251" class="mEditor">
<div class="m-label">
<label for="id223" title="Address">Address</label>
</div>
<div class="m-editor-noc">
<div id="id252" class="mfEditor">
<input type="text" class="tEditor" value="Address" name="" id="id223" maxlength="255" tabindex="0">
</div>
<div class="editor-links"></div>
</div>
</div>
<div id="id254" class="mEditor">
<div class="m-label">
<label for="id224" title="Address 2">Address 2</label>
</div>
<div class="m-editor-noc">
<div id="id255" class="mfEditor">
<input type="text" class="tEditor" value="16" name="" id="id224" maxlength="30" tabindex="0">
</div>
<div class="editor-links"></div>
</div>
</div>
<div id="id257" class="mEditor">
<div class="m-label">
<label for="id225" title="Postcode">Postcode</label>
</div>
<div class="m-editor-noc">
<div id="id258" class="mfEditor">
<input type="text" class="tEditor" value="Post Code" name="" id="id225" maxlength="10" tabindex="0">
</div>
<div class="editor-links"></div>
</div>
</div>
<div id="id25a" class="mEditor ">
<div class="m-label">
<label for="id20f" title="City">City</label>
</div>
<div class="m-editor-noc">
<div id="id25b" class="mfEditor">
<input type="text" class="tEditor" value="City" name="" id="id20f" autocomplete="off" maxlength="50" tabindex="0">
</div>
<div class="editor-links">
</div>
</div>
</div>
<div id="id25d" class="mEditor">
<div class="m-label">
<label for="id228" title="District">District</label>
</div>
<div class="m-editor-noc">
<div id="id25e" class="mfEditor">
<input type="text" class="tEditor" value="" name="" id="id228" maxlength="100" tabindex="0">
</div>
<div class="editor-links"></div>
</div>
</div>
<div id="id260" class="mEditor ">
<div class="m-label">
<label for="id210" title="Country">Country</label>
</div>
<div class="m-editor-noc">
<div id="id261" class="mfEditor">
<input type="text" class="tEditor" value="Country" name="" id="id210" autocomplete="off" maxlength="50" tabindex="0">
</div>
<div class="editor-links">
</div>
</div>
</div>
</div>
If by "We supporting all browser and Zoom level 75% - 125%" you mean you want a border to have the same size in actual pixels regardless of zoom level, you're out of luck. It's not technically possible.
You should only develop for zoom level of 100%.
There is no reliable cross-browser method to know the zoom level, which means this information is not available inside your Window object, so you can't use it to adjust values of properties on your elements.
As a fallback, you could just make the border thicker, so it will be visible even when zoomed. Now it's not displayed because it probably gets a sub-pixel size and estimated by the browser into non-renderable.
Do note everything you that's rendered at zoom levels other than 100% is entirely at the whim of how each browser internally chooses to estimate and render, which you:
have no control on
could change without notice.
In other words, your initial statement should have a minor footnote:
* Within reasonable limits. Rendering while zoomed is browser dependent.
I encountered a similar issue with border disappearing. This answer was extremely helpful to me. Draw borders by pseudo-elements. The solution for your case could be like:
.mEditor {
display: flex;
/*border-bottom: 1px solid #d7d7d7; <- REMOVE */
position: relative; /* <- ADD */
}
.mEditor::after{ /* <- ADD */
content: "";
position: absolute;
top:0;
bottom:0;
right:0;
left:0;
border-bottom: 1px solid #d7d7d7;
}
.m-label {
width: 30%;
display: flex;
background-color: #f2f2f2;
}
.m-editor-noc {
flex: 1;
display: flex;
background-color: #FFFFFF;
/*border-left: 1px solid #d7d7d7; <- REMOVE */
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
position: relative; /* <- ADD */
}
.m-editor-noc::after{ /* <- ADD */
content: "";
position: absolute;
top:0;
bottom:0;
right:0;
left:0;
border-left: 1px solid #d7d7d7;
}
.mfEditor {
display: flex;
flex: 1 0 auto;
}
.mEditor-li {
vertical-align: middle;
border-left: 1px solid #d7d7d7;
height: 18px;
display: inline-block;
margin-top: 3px;
}
.mEditor .tEditor {
border: none;
flex: 1;
padding-right: 6px;
}
<div class="m-group">
<div id="id251" class="mEditor">
<div class="m-label">
<label for="id223" title="Address">Address</label>
</div>
<div class="m-editor-noc">
<div id="id252" class="mfEditor">
<input type="text" class="tEditor" value="Address" name="" id="id223" maxlength="255" tabindex="0">
</div>
<div class="editor-links"></div>
</div>
</div>
<div id="id254" class="mEditor">
<div class="m-label">
<label for="id224" title="Address 2">Address 2</label>
</div>
<div class="m-editor-noc">
<div id="id255" class="mfEditor">
<input type="text" class="tEditor" value="16" name="" id="id224" maxlength="30" tabindex="0">
</div>
<div class="editor-links"></div>
</div>
</div>
<div id="id257" class="mEditor">
<div class="m-label">
<label for="id225" title="Postcode">Postcode</label>
</div>
<div class="m-editor-noc">
<div id="id258" class="mfEditor">
<input type="text" class="tEditor" value="Post Code" name="" id="id225" maxlength="10" tabindex="0">
</div>
<div class="editor-links"></div>
</div>
</div>
<div id="id25a" class="mEditor ">
<div class="m-label">
<label for="id20f" title="City">City</label>
</div>
<div class="m-editor-noc">
<div id="id25b" class="mfEditor">
<input type="text" class="tEditor" value="City" name="" id="id20f" autocomplete="off" maxlength="50" tabindex="0">
</div>
<div class="editor-links">
</div>
</div>
</div>
<div id="id25d" class="mEditor">
<div class="m-label">
<label for="id228" title="District">District</label>
</div>
<div class="m-editor-noc">
<div id="id25e" class="mfEditor">
<input type="text" class="tEditor" value="" name="" id="id228" maxlength="100" tabindex="0">
</div>
<div class="editor-links"></div>
</div>
</div>
<div id="id260" class="mEditor ">
<div class="m-label">
<label for="id210" title="Country">Country</label>
</div>
<div class="m-editor-noc">
<div id="id261" class="mfEditor">
<input type="text" class="tEditor" value="Country" name="" id="id210" autocomplete="off" maxlength="50" tabindex="0">
</div>
<div class="editor-links">
</div>
</div>
</div>
</div>

html tags in the same line do not work

In my html i have two input tags and i want them on the same line, after i search and try more code.
It doesn't change anything, what wrong is my code?
<div class="form-group">
<label class="col-lg-3 control-label">Meaning:</label>
<div class="col-lg-8">
<div class="">
<div class="lnw">
<span class="inline">
<input class="form-control" type="text" name="meaning[]" id="meaning " style="float: right">
<input type="image" src="/images/pjdict/plus.png" alt="Submit" width="48" height="48" class="add_field_button">
</span>
<br>
</div>
</div>
</div>
</div>
You have give some width for input["type="text"] or input["type="image"] like below:
Otherwise you cad custom class in form-control class and replease this class to .form-control
See Bootply link
.form-control {
float: left !important;
width: 90%;
}
.add_field_button {
float: right;
text-align: center;
width: 10%;
}
There is no need for a float:right in your code a form could simple be put
<input type="text">
<input type="text">
and they will show up beside each other also you should always put the type first
simply you can use display:inline-block to container of input tags
<html>
<body><div class="form-group">
<label class="col-lg-3 control-label">Meaning:</label>
<div class="col-lg-8">
<div class="">
<div class="lnw">
<span class="inline" style="display:inline-block"> //inline-block added here
<input class="form-control" type="text" name="meaning[]" id="meaning " style="float: right">
<input type="image" src="/images/pjdict/plus.png" alt="Submit" width="48" height="48" class="add_field_button">
</span>
<br>
</div>
</div>
</div>
</div>
</body>
</html>
Please use the below code for the same.
.inline input[type="text"] {
float:left;
margin:10px 10px 0px 0px;
}
<div class="form-group">
<label class="col-lg-3 control-label">Meaning:</label>
<div class="col-lg-8">
<div class="">
<div class="lnw">
<span class="inline">
<input class="form-control" type="text" name="meaning[]" id="meaning " >
<input type="image" src="/images/pjdict/plus.png" alt="Submit" width="48" height="48" class="add_field_button">
</span>
<br>
</div>
</div>
</div>
</div>
You are setting the type of your input field to 'image', which according to this page isn't valid in bootstrap, and in general isn't valid for html. I can only guess what you're trying to do, but from the way things look, you want:
a text input field
a submit button to the right of the text input field
an image instead of the regular submit button appearance
If that is accurate, take a look at the following snippet:
#formElementContainer {
margin-top: 60px; /* this is only important for display within this snippet */
}
#formElementContainer input[type='text'] {
width: calc(100% - 50px);
}
#formElementContainer input[type='submit'] {
background: transparent url('https://www.gravatar.com/avatar/eb603bf5dd01c06880fdb8e4e1d04df3?s=32&d=identicon&r=PG&f=1') center center no-repeat;
border: none;
width: 32px;
height: 32px;
}
<div id="formElementContainer">
<input type="text" />
<input type="submit" value="" />
</div>

How do I get these text input boxes to line up?

How do I get the text input boxes to line up?
The password input box is slightly to the left, it is not aligned with the username text input box.
I am using Java, in Eclipse.
<div>
<div id="header">
<h1>Login</h1>
</div>
<form name="loginform">
<fieldset>
<legend>Login Form</legend>
<label>Username:
<input type="text" name="username" /><span>*</span>
</label>
<label>Password:
<input type="password" name="pass" /><span>*</span>
</label>
<input type="reset" class="resetButton" />
<input type="submit" value="Login" class="submitButton" />
</fieldset>
</form>
</div>
If you want it to be dynamic, you need a grid (row/column) structure, and the best one (cross browser) today is display: table, as display: grid is still widely unsupported (working draft | caniuse)
h1 {letter-spacing: 1px; font-size: .4in; color: green;}
legend {font-variant: small-caps; font-weight: bold}
fieldset{width: 300px; font-family: Arial, sans-serif;
background-color : limegreen}
label {display: block; position: relative; line-height: 2;}
.text {position: absolute; margin-left: 20px; width: 15em; left: 80px}
.grid {
display: table;
}
.row {
display: table-row;
}
.col {
display: table-cell;
padding: 6px 0 0 6px;
}
.col.after:after {
content: ' *';
color: red;
}
<div>
<div id="header">
<h1>Login</h1>
</div>
<form name="loginform">
<fieldset>
<legend>Login Form</legend>
<div class="grid">
<div class="row">
<div class="col">
<label for="username">Username:</label>
</div>
<div class="col after">
<input type="text" name="username" id="username"/>
</div>
</div>
<div class="row">
<div class="col">
<label for="pass">Password:</label>
</div>
<div class="col after">
<input type="password" name="pass" id="pass"/>
</div>
</div>
<div class="row">
<div class="col">
</div>
<div class="col">
<input type="reset" class ="resetButton"/>
<input type="submit" value = "Login" class="submitButton"/>
</div>
</div>
</div>
</fieldset>
</form>
</div>
In a perfect W3 standard world, your label would be a field that stands on its own, not a field that encapsulates the input. So, for instance:
<label for="username">Username:</label>
<input id="username" type="text" name="username"/><span>*</span>
The "for" tag refers to the ID of the input field that you'd have to add. Styling, then would be as simple as adding on a width to the style of the label. For positioning purposes, you could display-inline on the required asterisk to position it after the input.
Enclose the username and password labels in an inline-block span and give that span a width.
Your updated html looks like this:
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1"/>
<title>Test</title>
</head>
<body>
<style tpye ="text/css">
h1 {letter-spacing: 1px; font-size: .4in; color: green;}
span {color: red}
legend {font-variant: small-caps; font-weight: bold}
fieldset{width: 300px; font-family: Arial; sans-serif;
background-color : limegreen}
label {display: block; position relative; line-height: 2;
margin: 10px 0px;}
.text {position: absolute; margin-left: 20px; width: 15em; left: 80px}
span.myspan{width: 100px; display:inline-block;}
</style>
<div>
<div id="header">
<h1>Login</h1>
</div>
<form name="loginform">
<fieldset>
<legend>Login Form</legend>
<label><span class="myspan">Username:</span> <input type="text" name="username"/><span>*</span></label>
<label><span class="myspan">Password:</span> <input type="password" name="pass"/><span>*</span></label>
<input type="reset" class ="resetButton"/>
<input type="submit" value = "Login" class="submitButton"/>
</fieldset>
</form>
</div>
</body>
</html>
Test here: https://jsfiddle.net/nabtron/d4cr66oa/
This one worked, thank you.
h1 {letter-spacing: 1px; font-size: .4in; color: green;}
legend {font-variant: small-caps; font-weight: bold}
fieldset{width: 300px; font-family: Arial, sans-serif;
background-color : limegreen}
label {display: block; position: relative; line-height: 2;}
.text {position: absolute; margin-left: 20px; width: 15em; left: 80px}
.grid {
display: table;
}
.row {
display: table-row;
}
.col {
display: table-cell;
padding: 6px 0 0 6px;
}
.col.after:after {
content: ' *';
color: red;
}
<div>
<div id="header">
<h1>Login</h1>
</div>
<form name="loginform">
<fieldset>
<legend>Login Form</legend>
<div class="grid">
<div class="row">
<div class="col">
<label for="username">Username:</label>
</div>
<div class="col after">
<input type="text" name="username" id="username"/>
</div>
</div>
<div class="row">
<div class="col">
<label for="pass">Password:</label>
</div>
<div class="col after">
<input type="password" name="pass" id="pass"/>
</div>
</div>
<div class="row">
<div class="col">
</div>
<div class="col">
<input type="reset" class ="resetButton"/>
<input type="submit" value = "Login" class="submitButton"/>
</div>
</div>
</div>
</fieldset>
</form>
</div>

HTML complex form layout using DIV's

I need to make multi-column form layout, where each row can have different count of fields, like this:
First time I used table and td's colspan attribute for creating layout. But I read that laying out using tables is not good idea, so I want to improve my code to use div's.
So can anybody give me good example of how to make layout like above according to best practices? The most problem to me is that width of columns is different.
Thanks.
Don't kill me for not writing 100% valid input fields and not a clear layout with margins etc.
Sample
http://jsfiddle.net/hpmJ7/4/
HTML
<div>
<div class="w50">
<span class="label">Name</span>
<input type="text" value="Test" />
</div>
<div class="w50">
<span class="label">Surname</span>
<input type="text" value="Test" />
</div>
<div class="w100">
<span class="label">Contact</span>
<input type="text" value="Test" />
</div>
<div class="w50">
<span class="label">Age</span>
<input type="text" value="Test" />
</div>
<div class="w50">
<span class="label">Email</span>
<input type="text" value="Test" />
</div>
<div class="w70">
<span class="label">Phone</span>
<input type="text" value="Test" />
</div>
<div class="w30">
<span class="label">Time</span>
<input type="text" value="Test" />
</div>
<div class="w50">
<span class="label">Age</span>
<input type="text" value="Test" />
</div>
<div class="w50">
<span class="label">Email</span>
<input type="text" value="Test" />
</div>
</div>
CSS
* {
margin: 0;
padding: 0;
}
.label {
width: 60px;
display: inline-block;
}
.w30, .w50, .w70, .w100 {
height: 20px;
float: left;
display: inline-block;
width: 100%;
}
.w30{
width: 30%;
}
.w50{
width: 50%;
}
.w70{
width: 70%;
}
.w100{
width: 100%;
}
The trick here is to come up with some sort of grid system. In my example, I've put together a 5% based grid system. You can see a basic example of some of your exact pieces in this fiddle.
#container { font-size: 12px; width: 700px; }
.row { float: left; margin: 5px 0; width: 100%; }
.w10 { width: 10%; }
.w15 { width: 15%; }
.w20 { width: 20%; }
.w25 { width: 25%; }
.w30 { width: 30%; }
.w35 { width: 35%; }
.w40 { width: 40%; }
.w50 { width: 50%; }
.w60 { width: 60%; }
.w70 { width: 70%; }
.w80 { width: 80%; }
.w90 { width: 90%; }
.w100 { width: 100%; }
.item { box-sizing: border-box; float: left; }
input, select, option { margin: 0; }
And I've placed the items into rows to provide for a clean, grid-like look.
<div id="container">
<div class="row">
<div class="item w15">/* Entity Name</div>
<div class="item w35">Maricopa County Community College District</div>
<div class="item w50">*Domain: USPF, SLG, Special Districts, Community College</div>
</div>
<div class="row">
<div class="item w15">/* Doctype</div>
<div class="item w10">NLP?</div>
<div class="item w20">Filename/Keywords</div>
<div class="item w20">*Source Frequency</div>
<div class="item w35">
<input type="radio" name="freq" checked="checked" />
<label>Daily</label>
<input type="radio" name="freq" />
<label>Weekly</label>
<input type="radio" name="freq" />
<label>Monthly</label>
</div>
</div>
<div class="row">
<div class="item w15">
<input type="checkbox"/>
<label>Audit</label>
</div>
<div class="item w10">
<input type="checkbox"/>
</div>
<div class="item w20">
<input type="text"/>
</div>
<div class="item w20">*Every</div>
<div class="item w15">
<input type="text" class="w20" value="1"/>
<label>Days</label>
</div>
<div class="item w20">
<select>
<option value="utc-6">UTC -6</option>
</select>
</div>
</div>
</div>
Basically, a specific structure is what you're after, and a grid-like system placed in rows is a great way to do that.
Tables are not that bad.
The reason of why tables are not recomended for layout is that the table is loaded(content of it is shown) only when everything in the table has loaded in the page. But divs show their contents as soon as they are loaded.
Now in you case your form looks fairly complex to me and I think it is not desirable to show partial contents of this form while page is still loading. You definitly want to show all the fields of your form at the same time.
Also, when you want to represent tabular data (which I think applies to your case) then it is recomended to use tables.
So I would suggest(I may be wrong, please somebody correct me if I am) using table for this form of yours.
Also one more benefit that tables provide is you don't have to worry too much about the alignment of your contents.
You can basically create multiple css classes which will depict all those widths you want to depict. It will not be strictly flexible columns, but more like flexible rows, you will have to think in terms of rows instead of columns.
so for each row you would attach specific width classes
<div class="row">
<div class="left width-50"></div>
<div class="right width-50"></div>
</div>
<div class="row">
<div class="left width-70"></div>
<div class="right width-30"></div>
</div>
<div class="row">
<div class="left width-100"></div>
</div>
....
....
Hope it will help.
Check this out:
HTML
<html>
<head>
<link rel="stylesheet" href="contactForm.css"></link>
</head>
<body>
<div id="contactform">
<div id="first">
<div id="name">
<div id="description">Name</div>
<input type="text" name="textName">
</div>
<div id="surname">
<div id="description"> Surname</div>
<input type="text" name="textSurname">
</div>
</div>
<div id="second">
<div id="contact"><div id="description">Contact</div> <input type="text" name="textContact"></div>
</div>
<div id="third">
<div id="age">
<div id="description">Age</div>
<input type="text" name="textAge">
</div>
<div id="e-mail">
<div id="description">E-mail</div>
<input type="email" name="textEmail">
</div>
</div>
<div id="fourth">
<div id="phone">
<div id="description">Phone</div>
<input type="text" name="textPhone">
</div>
<div id="time">
<div id="description">Time</div>
<input type="date" name="textTime">
</div>
</div>
</div>
</body>
</html>
CSS
#contactform {width:500px; height:500px;}
#contactform div {float:left; padding-top:5px;}
#first, #second, #third, #fourth {width:100%;}
#first #description {width:30%;}
#name, #surname {width:50%;}
#surname #description {margin-left:11px;}
#first input {width:65%;}
#second #description {width:15%;}
#contact {width:100%;}
#second input {width:85%;}
#third #description {width:30%;}
#age, #e-mail {width:50%;}
#e-mail #description {margin-left:11px;}
#third input {width:65%;}
#fourth #description {width:30%;}
#phone, #time {width:50%;}
#time #description {margin-left:11px;}
#fourth input {width:65%;}
Output
HTH.