Get date in center of page - html

How can I get the dates in the center of the main div.
JSFiddle
<style>
.div_table{
display:table;
width:100%;
}
.div_table_row{
display:table-row;
width:auto;
clear:both;
}
.div_table_col{
display:table-column;
float:left;/*fix for buggy browsers*/
}
label
{
width: 10em;
text-align: left;
margin-right: 0.5em;
display: block;
}
input
{
color: #781351;
background: #fee3ad;
border: 1px solid #781351
}
</style>
<div class="div_table">
<div class="div_table_row">
<img src="./images/logo_transparent.png" width="192" height="69" alt="Logo" />
</div>
<div class="div_table_row">
<?php include_once("./include/menu.php"); ?>
</div>
<div class="div_table_row">
<div style="text-align:center">
<label>From Date:<br /><input type="text" class="date" /></label>
<label>To Date:<br /><input type="text" class="date" /></label>
</div>
</div>
<div class="footer div_table_row">All Rights Reserved</div>
</div>

Whould you like to center the labels or the input textfields?
If labels do this:
<label><span>From Date:</span><br /><input type="text" class="date" /></label>
<label><span>To Date:</span><br /><input type="text" class="date" /></label>
Put the text in the label into a span.
in CSS:
label span {
position: absolute;
left: 50%;
}
Add position: relative; to .div_table_row.

Related

label and the felder are not center in the rows

I have a problem with your form, how can I put the text and the elements at the same distance, e.g. show the label next to the fields, they are not on the same line, i.e. not centered on the line,
pls see pic on the Link
My Form
I have a problem with your form, how can I put the text and the elements at the same distance, e.g. show the label next to the fields, they are not on the same line, i.e. not centered on the line,
pls see pic on the Link
My Form
I have a problem with your form, how can I put the text and the elements at the same distance, e.g. show the label next to the fields, they are not on the same line, i.e. not centered on the line,
pls see pic on the Link
My Form
body{
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
background-color: #FFBB00;
}
.container{
width: 40%;
margin: 4% auto;
padding: 50px;
background-color: #fff;
border-radius: 15px;
box-shadow: #ccc 0 0 10px 0; /* للظل لحتى يطلع متناسب */
}
.title h1{
position: relative;
text-align: center;
font-size: 28px;
text-transform: uppercase;
}
.title h1::after{
content: "";
width: 30%;
height: 3px;
background-color: #FFBB00;
position: absolute;
top: 110%;
left: 35%;
}
.inputFeld{
padding: 10px;
margin: 10px;
border-radius:4px;
border: 1px solid #ccc;
}
.inputFeld:focus{
background-color: #FFBB00; ;
}
/* */
.parent-line{
display: flex;
flex-wrap: wrap;
justify-content: center;
align-content: center;
padding: 15px;
}
.parent-line .line-link{
display: flex;
flex: 1;
}
.parent-line .line-right{
flex: 1;
display: flex;
}
.parent-one-line{
padding: 15px;
}
.container .line label{
display: inline-block;
width: 150px;
text-align: left;
}
/* */
.btn{
padding: 19px 10px;
margin-bottom: 500px;
background-color: #000;
color: #fff;
border: none;
float: right;
cursor: pointer;
width: 100%;
}
.btn:hover{
background-color: #FFBB00;
color: #000;
}
.checken{
padding: 10px;
}
.select{
padding: 10px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<link rel="stylesheet" href="style.css">
<style>
#import url('https://fonts.googleapis.com/css2?family=Poppins:wght#300&display=swap');
</style>
<body>
<section class="container">
<dic class="title"><h1>ITEMS VERLINKEN </h1></dic>
<form action="">
<!-- -->
<div class="parent-line">
<div class="line-link">
<div class="line"> <label class="" for=""> Link URL </label> <input class="inputFeld" type="text" name="" id="" > </div>
</div>
<div class="line-right">
<div class="line"> <label for=""> +articleNum+ </label> <input class="inputFeld" type="text" name="" id="" > </div>
</div>
</div>
<!-- -->
<div class="parent-line">
<div class="line-link">
<div class="line"> <label for=""> Full PDF name </label> <input class="inputFeld" type="text" name="" id="" placeholder="Example: test.pdf ">
</div>
</div>
<div class="line-right">
<div class="line"> <label for=""> Full PDF Links </label>
<input class="checkbox" type="checkbox" name="" id="">
</div>
</div>
</div>
<!-- -->
<div class="parent-line">
<div class="line-link">
<div class="line"> <label for=""> PDF Width in mm</label>
<input class="inputFeld" type="text" name="" id="" placeholder="Example: 212" size="4">
</div>
</div>
<div class="line-right">
<div class="line"> <label for=""> PDF Height in mm</label>
<input class="inputFeld" type="text" name="" id="" placeholder="Example: 290 " size="4">
</div>
</div>
</div>
<!-- -->
<div class="parent-line">
<div class="line-link">
<div class="line">
<label for=""> Border around links</label>
<select class="select" name="" id="">
<option value="">No</option>
<option value="">Yes</option>
</select>
</div>
</div>
<div class="line-right">
<div class="line"> <label for=""> Border(RGB):</label>
<input class="inputFeld" type="text" name="" id="" placeholder="R" size="1">
<input class="inputFeld" type="text" name="" id="" placeholder="G" size="1" >
<input class="inputFeld" type="text" name="" id="" placeholder="B" size="1">
</div>
</div>
</div>
<!-- -->
<div class="parent-line">
<div class="line-link">
<div class="line">
<label for=""> Border Width(mm)</label> <select class="select" name="" id="">
<option value="">0</option>
</select>
</div>
</div>
<div class="line-right">
<div class="line">
<label for="">Margin top (mm)</label> <select class="select" name="" id="">
<option value="">0</option>
</select>
</div>
</div>
</div>
<!-- -->
<div class="parent-one-line">
<div class="line"> <label for=""> Save settings: </label> <input class="inputFeld" type="text" name="" id="" placeholder="Example: Customer1 ">
<h5>Leave empty to prevent saving.</h5>
</div>
<input class="btn" type="button" value="Start">
</div>
</form>
</section>
</body>
</html>
Simply add align-items:center to
.parent-line .line-right{
flex: 1;
display: flex;
}
and increase/decrease input text height/font size to match the center.

Unable to type a response in an <input> tag

Goal: I am trying to make a form for users to submit their school schedule
Problem: the first of my input tags will not let me type an input. All the input sections are set up the same accept for their place holder text. they all follow the same pattern and have the same classes applied.
Notes: I know you are able to type in the input field inside of the snippet but it does not work when implemented into my full webpage. Also I'm fairly new to HTML/CSS so excuse the fact that my code is kinda messy. Any constructive criticism is openly accepted.
.form {
width: 680px;
height: 870px;
}
.inputConatiner {
height: 75px;
width: 680px;
display: inline-block;
float: left;
}
.textContainer {
height: 75px;
width: 405px;
display: inline-block;
}
.submitContainer {
width: 100%;
height: 40px;
position: relative;
}
.submit {
height: 40px;
width: 150px;
display: inline-block;
position: absolute;
left: 50%;
top: 2075%;
margin: 0 0 0 -75px;
}
input[type="text"] {
border: black 0px solid;
border-radius: 20px;
background-color: rgb(230, 230, 230);
padding-top: 13px;
padding-bottom: 13px;
font-family: "Arial";
}
input[type="radio"] {
height: 30px;
width: 30px;
margin: 0;
vertical-align: middle;
}
input[type="submit"] {
height: 40px;
width: 150px;
border: black 0px solid;
border-radius: 20px;
}
label[for="A"],
label[for="B"] {
display: inline-block;
width: 160px;
font-family: "Arial";
}
fieldset {
border: black 0px solid;
padding: 0px;
}
.label {
width: 270px;
height: 40px;
font-family: "Nunito Sans";
font-size: 30px;
display: inline-block;
background-color: rgb(104, 255, 144);
border-radius: 20px;
text-align: center;
vertical-align: middle;
}
input {
width: 200px;
}
<head>
<title>Side Project</title>
<link rel="stylesheet" type="text/css" href="css/styles.css">
<link href="https://fonts.googleapis.com/css?family=Nunito+Sans" rel="stylesheet">
</head>
<div class="form">
<form method="post" action="#" name="getStudentInfo">
<div class="inputConatiner">
<h1 class="label">Enter Your Name</h1>
<div class="textContainer">
<input type="text" placeholder="First" required />
<input type="text" placeholder="Last" required />
</div>
</div>
<div class="inputConatiner">
<h1 class="label">1A Class</h1>
<div class="textContainer">
<input type="text" placeholder="Class" required />
<input type="text" placeholder="Teacher" required />
</div>
</div>
<div class="inputConatiner">
<h1 class="label">2A Class</h1>
<div class="textContainer">
<input type="text" placeholder="Class" required />
<input type="text" placeholder="Teacher" required />
</div>
</div>
<div class="inputConatiner">
<h1 class="label">3A Class</h1>
<div class="textContainer">
<input type="text" placeholder="Class" required />
<input type="text" placeholder="Teacher" required />
</div>
</div>
<div class="inputConatiner">
<h1 class="label">4A Class</h1>
<div class="textContainer">
<input type="text" placeholder="Class" required />
<input type="text" placeholder="Teacher" required />
</div>
</div>
<div class="inputConatiner">
<h1 class="label">A Day Lunch</h1>
<input type="radio" id="A" name="lunchADay" />
<label for="A">First Lunch</label>
<input type="radio" id="B" name="lunchADay" />
<label for="B">Second Lunch</label>
</div>
<div class="inputConatiner">
<h1 class="label">1B Class</h1>
<div class="textContainer">
<input type="text" placeholder="Class" required />
<input type="text" placeholder="Teacher" required />
</div>
</div>
<div class="inputConatiner">
<h1 class="label">2B Class</h1>
<div class="textContainer">
<input type="text" placeholder="Class" required />
<input type="text" placeholder="Teacher" required />
</div>
</div>
<div class="inputConatiner">
<h1 class="label">3B Class</h1>
<div class="textContainer">
<input type="text" placeholder="Class" required />
<input type="text" placeholder="Teacher" required />
</div>
</div>
<div class="inputConatiner">
<h1 class="label">4B Class</h1>
<div class="textContainer">
<input type="text" placeholder="Class" required />
<input type="text" placeholder="Teacher" required />
</div>
</div>
<div class="inputConatiner">
<h1 class="label">B Day Lunch</h1>
<input type="radio" id="A" name="lunchBDay" />
<label for="A">First Lunch</label>
<input type="radio" id="B" name="lunchBDay" />
<label for="B">Second Lunch</label>
</div>
<div class="submitContainer">
<div class="submit">
<input type="submit" placeholder="Submit" />
</div>
</div>
</form>
</div>
You have floated the row elements but not cleared them. As a result, the submit button's container element sits at the top of the page, partially overlapping the rows, even though the button itself has been pushed to the bottom (using absolute positioning).
Instead of doing this, you need to first clear the floated elements using .submitContainer, and center-align the button within it:
.submitContainer {
width: 100%;
height: 40px;
position: relative;
/* CLEAR THE FLOATED ROWS */
clear: both;
/* CENTER-ALIGN THE CONTENTS OF THIS CONTAINER */
text-align: center;
}
Next, remove the absolute positioning from the .submit element itself, as well as the negative margin (since it is now being aligned by its container):
.submit {
height: 40px;
width: 150px;
display: inline-block;
/* position: absolute; <- REMOVE THIS */
/* left: 50%; <- REMOVE THIS */
/* top: 2075%; <- REMOVE THIS */
/* margin: 0 0 0 -75px; <- REMOVE THIS */
}
That will allow the submit container and button to sit below the form without having to push it down.
The problem is that your wrapper div for submit button is overlapping the first input. Since you've used float: left in all your inputs, try and contain all of them in one div tag.
Add this to your css
.clearfix::after {
content: "";
clear: both;
display: table;
}
And wrap your inputs like
<form method="post" action="#" name="getStudentInfo">
<div class="clearfix">
<div class="inputConatiner">
...
</div>
<div class="inputConatiner">
...
</div>
<div class="inputConatiner">
...
</div>
<div class="inputConatiner">
...
</div>
<div class="inputConatiner">
...
</div>
<div class="inputConatiner">
...
</div>
<div class="inputConatiner">
...
</div>
<div class="submitContainer">
<div class="submit">
<input type="submit" placeholder="Submit" />
</div>
</div>
</form>
Let me start by telling that your css and containers work needs more working...
Your first input tag did not let you type since the "submitcontainer" was overlapping the input tags... I removed the submit Container and positioned the submit button slightly... But I implore you to learn some styling and not dependent on absolute positions...
<div class="submit">
<input type="submit" placeholder="Submit" />
</div>
.submit {
height: 40px;
width: 150px;
display: inline-block;
position: absolute;
left: 30%;
top: 100%;
margin: 0 0 0 -75px;
}
Codepen link: https://codepen.io/anon/pen/MrJGrN

Vertical center an absolutely positioned input field inside its surrounding element

I simply want to vertically center an input field inside its surrounding DIV, but at the same time all input fields on the page should be horizontally aligned with each other (should have the same left value, if you will).
Here's an example page of the problem:
.wrapper {
border: 1px solid #000;
border-radius: 10px;
margin: 10px;
padding: 10px;
line-height: 40px;
}
.inputClass {
position: absolute;
left: 25%;
/* top: 50%; transform: translate(0, -50%); */
/* not working as I need */
vertical-align: middle;
}
<div class="wrapper">
<div>
<div>
Some text
<input type="text" class="inputClass" />
</div>
<div>
Some more text
<input type="text" class="inputClass" />
</div>
</div>
</div>
Desired result (blue rim by Firebug):
You can group inputs+labels in fieldsets and then use the labels for moving the inputs towards the center,
try this:
.wrapper {
border: 1px solid #000;
border-radius: 10px;
margin: 10px;
padding: 10px;
line-height: 40px;
}
fieldset {
border: 0;
/*resets UA*/
}
/*can use label to move inputs right*/
label {
width:40%;
display:inline-block;
padding-right :15px;
text-align:right
}
<div class="wrapper">
<div>
<fieldset>
<label for='one'>Some text</label>
<input id='one' type="text" class="inputClass" />
</fieldset>
<fieldset>
<label for='two'>Some more text</label>
<input id='two' type="text" class="inputClass" />
</fieldset>
</div>
</div>
Put the text in a label (this is good practice anyway) and use inline block to position the elements beside each other. You can then give the label a width as required:
.wrapper {
border: 1px solid #000;
border-radius: 10px;
margin: 10px;
padding: 10px;
line-height: 40px;
}
.wrapper label {
display:inline-block;
width:25%;
vertical-align:middle;
}
.wrapper input {
display:inline-block;
vertical-align:middle;
}
<div class="wrapper">
<div>
<div>
<label for="field1">Some text</label>
<input id="field1" type="text" class="inputClass" />
</div>
<div>
<label for="field2">Some more text</label>
<input id="field2" type="text" class="inputClass" />
</div>
</div>
</div>
An excellent way to do this (in my opinion) would be using the table tag in HTML to organise the input fields and the labels. I would then use the "valign" property and set it to "TOP" e.g.
<table>
<tr>
<td valign="TOP">
Some text
</td>
<td valign="TOP">
<input type="text" class="inputClass" />
</td>
</tr>
<tr>
<td valign="TOP">
Some more text
</td>
<td valign="TOP">
<input type="text" class="inputClass" />
</td>
</tr>
</table>
The valign="TOP" assigned to the TD will make it be at the top of the cell in the table. This will ensure that they will be vertically and horizontally aligned with each other.
Another answer without using the table tag:
<style>
li {
width: 120px;
}
</style>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<div>
<ul class="list-inline">
<li>Some text</li>
<li>
<input type="text">
</li>
</ul>
<ul class="list-inline">
<li>Some more text</li>
<li>
<input type="text">
</li>
</ul>
</div>
This would be used using BootStrap in order to list it in line.
A possible solution would be to put all the form labels in a div with class "col-left" & the input fields in a div with class "col-right". Both these are vertically middle aligned (vertical-align: middle) & the left column holding the labels have an equal width setting.
Please find below the complete solution:
.wrapper {
border: 1px solid #000;
border-radius: 10px;
margin: 10px;
padding: 10px;
line-height: 40px;
}
.col-left, .col-right {
vertical-align: middle;
display:inline-block;
}
.col-left {
width: 20%;
}
<div class="wrapper">
<div>
<div class="col-left">Some text</div>
<div class="col-right">
<input type="text" class="inputClass" />
</div>
</div>
<div>
<div class="col-left">Some more text</div>
<div class="col-right">
<input type="text" class="inputClass" />
</div>
</div>
</div>

creating css template using div

I'm trying to cretate temple for all my pages using div tag.
I want my template as
In my layout 'o' is outer container, 'L' is log div, 's' is side menu div and 'c' is content div.I created my template but my problem is my content inside 'content div' is overlaped as send shot.
Hot to get ride of this problem.
.rest {
height: 685px;
padding: 0px 7px;
}
.sidemenu {
float: left;
margin-top: 150px;
width: 100%;
}
.content {
position:relative;
}
.side{
width: 24%;
float: left;
display: inline-block;
}
form[name=profile] p {
padding-left: 20%;
}
hr {
margin: 0;
width: 1px;
height: 660px;
border: 0;
background: #fff;
float: left;
}
h1{
display:inline-block;
text-align:center
margin-left:20px;
margin-right:-40px;
}
.outer {
margin-left: 20%;
margin-top: 3%;
margin-bottom: 3%;
height: 737px;
width: 60%;
box-shadow: 10px 10px 5px #888888;
border: 1px solid #f9f2f2;
border-radius: 10px;
}
button.logout{
display:inline;
float:right;
margin-right:10px;
}
.lout{
float: right;
display: inline-block;
margin-top: 10px;
}
.log {
width:60%;
height: 10%;
position: absolute;
border: 1px solid #f9f2f2;
border-radius: 10px;
display:inline-block;
}
.sidemenu {
float: left;
margin-top: 150px;
width: 100%;
}
.content {
position:relative;
}
<div class="outer">
<div class="log">
<h1>Profile</h1>
<form method="post" class="lout" > <button class="logout" name="logout" >Logout</button></form>
</div> <!--End of log div -->
<div class="rest">
<div class="side">
<div class="sidemenu">
<div class="1 menu">
Profile
</div> <!--End of menu1 -->
<div class="2 menu">
Clients
</div> <!--End of menu 2-->
<div class="3 menu">
Employees
</div> <!--End of menu 3-->
<div class="menu 4">
Documents
</div> <!--End of menu 4-->
</div> <!--End of side menu -->
</div> <!--End of side div -->
<hr>
<!-- <div class="heading" >
<h1>Profile</h1>
</div> End of heading div -->
<div class="content">
<?php
include "config.php";
if($ses!='')
{
$sql="select * from register where id=$ses";
$sql1=mysql_query($sql);
$fet=mysql_fetch_assoc($sql1);
$name=$fet['name'];
$email=$fet['email'];
$phone=$fet['phone'];
$cname=$fet['company_name'];
$street=$fet['street'];
$add=$fet['address'];
$city=$fet['city'];
$state=$fet['state'];
$ein=$fet['ein'];
$id=$fet['id'];
}
?>
<form name="profile" method="post" >
<p>Name<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $name; ?>"</p>
<p>Email<input type="text" size=20 name="mail" maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $email; ?>"</p>
<p>Phone<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $phone; ?>"></p>
<p>Company name<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $cname;?>"></p>
<p>Street<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $street;?>"></p>
<p>Address<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $add; ?>"></p>
<p>City<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $city;?>"></p>
<p>State<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $state; ?>"></p>
<p>EIN<input type="text" size=20 maxlength=50 style="background-color:transparent;border:0px solid white;" readonly value="<?php echo $ein;?>"></p>
<a class="change">Change Password</a><br>
<div class="pass">
<br><input type="password" class="textbox" placeholder="Current Password" name="old" id="old" size="20"/><br><br>
<input type="password" class="textbox" placeholder="New Password" name="new" id="new" size="20"><br>
<br><br><br><br><button class="add" name="go" id="go">Go</button><a style="padding-right:2ex;"></a><a class="change"><button class="add" name="cancel" id="cancel">Cancel</button></a>
</div>
<br>
<div class="tri"><button name="edit" class=add>&nbsp&nbspEdit&nbsp</button><button name="add" class="upload" onclick="admin()">Add New</button></div></form>
</div> <!--End of content -->
</div> <!--End of rest div -->
</div> <!--End of outer div-->
The div with class="log" has "position: absolute;" - Absolutely positioned elements are removed from the normal flow. The document and other elements behave like the absolutely positioned element does not exist.
Absolutely positioned elements can overlap other elements.
If you want "L" to be absolute positioned you can give a padding-top to the div with class="rest" which to be equal to the class="log" div's height.

How do I have a textbox be 100% width without moving its siblings to the next line?

I'm interested in having a textbox take up 100% width of the remaining space but without dropping the text "name" or the button to the next line:
<div style="width: 100%; padding: 20px; background-color: #c0c0c0">
<span>Name:</span>
<span><input type="textbox" style="width:100%" /></span>
<span><input type="button" value="Search" /></span>
</div>
http://jsfiddle.net/GP2nA/1/
How can I prevent the text and button from dropping to the next line?
Tested in IE7/8, Firefox, Chrome, Opera.
Live Demo
Live Demo (minus extra wrapper div)
CSS:
#search {
padding: 20px; background-color: #c0c0c0;
overflow: auto
}
#search div {
position: relative
}
.name {
float: left
}
.input {
position: absolute;
top: 0; right: 70px; left:55px;
}
.submit {
float: right
}
HTML:
<div id="search">
<div>
<span class="name">Name:</span>
<span class="input"><input type="input" style="width:100%" /></span>
<span class="submit"><input type="button" value="Search" /></span>
</div>
</div>
(You should have a form and a label tag in there)
UPDATED: http://jsfiddle.net/QaWMN/2/
Works in: ie7, ie8, ff, chrome
If you need ie6 read this: http://www.alistapart.com/articles/conflictingabsolutepositions/
html:
<div style="padding: 20px; background-color: #c0c0c0; position: relative;">
<span class="desc">Name:</span>
<div class="full">
<input type="textbox" class="tb" /></div>
<input type="button" value="Search" class="button" />
</div>
css:
span {position: absolute;}
.full {position: absolute; left: 60px; right: 100px; top: 8px;}
.desc {left: 10px; top: 8px; width: 100px;}
.tb {width: 100%; display: block;}
.button {right: 10px; width: 80px; top: 8px; position: absolute}
You could use something like the following:
<div style="padding: 20px; background-color: #c0c0c0">
<span style="width:10%;">Name:</span>
<span><input type="textbox" style="width:80%" /></span>
<span><input style="width:10%;" type="button" value="Search" /></span>
</div>
Where we simply give all elements (label, input and button) a percentage of the width to eat. Note that you will need to examine your form elements and adjust the 10% of labels to compensate for that of your widest label, and alter the 80% width of the input field accordingly too.
Also, as commented by another, extract your styles and place them in CSS classes as opposed to writing them inline.
It doesn't really quite work that way in css without fancy JavaScript. However, you CAN get the same look to happen with a slight reworking:
<div style="width: 100%; padding: 20px; background-color: #c0c0c0">
<div style="width: 10%; float:left;">
<span>Name:</span>
<span><input type="button" value="Search" /></span>
</div>
<div style="width: 90%; float:left;"</div>
<span><input type="textbox" style="width:100%" /></span>
</div>
<div style="clear:both;"></div>
</div>
Or easier:
<div style="width: 100%; padding: 20px; background-color: #c0c0c0">
<div style="width: 10%; float:left;">Name:</div>
<input type="textbox" style="width:80% float:left;" />
<input type="button" value="Search" style="width: 10%; float:left;" />
</div>
<div style="display: table; width: 100%">
<div style="display: table-row; padding: 20px; background-color: #c0c0c0">
<span style="display: table-cell;">Name:</span>
<input type="textbox" style="display: table-cell; width:100%" />
<span style="display: table-cell;">
<input type="button" value="Search" />
</span>
</div>
</div>
See updated fiddle.
Note: The advantage of using this method is that you won't have to set a width on the label or the button.