Centering Textbox inside Div Tag - html

I am trying to center my text box within the div. I have searched and tried. I even tried centering the input box alone with a margin of 0 but had no such luck. Please help.
Here is the JS Fiddle I made to aid with helping. Also there is a strange white space at the bottom. Please see the fiddle. Thanks a lot.
HTML:
<footer>
<div class="footerContainer">
<div class="footerLeft">
<h3>CONTACT US</h3>
<br />
<form name="contact" action="">
<table cellpadding="10">
<tr>
<td>
<label for="name" id="name_label"></label>
</td>
<td>
<input type="text" name="name" id="name" size="50" value="" class="text-input" placeholder="Your Name"/>
<label class="error" for="name" id="name_error"><br />This field is required.</label>
</td>
</tr>
<tr>
<td>
<label for="email" id="email_label"></label>
</td>
<td>
<input type="text" name="email" id="email" size="50" value="" class="text-input" placeholder="Your Email"/>
<label class="error" for="email" id="email_error"><br />This field is required.</label>
</td>
</tr>
<tr>
<td>
<label for="comment" id="comment_label"></label>
</td>
<td>
<textarea name="comment" id="comment" rows="8" cols="50" placeholder="Your Message"/></textarea>
<label class="error" for="comment" id="comment_error"><br />This field is required.</label>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="submit" class="button" id="submit_btn" value="Submit" />
</td>
</tr>
</table>
</form>
</div>
<div class="footerRight">
<h3>CABRINI REPERTORY THEATRE</h3>
<sub>701 Fort Washington Avenue</sub>
<br />
<h3>Get Social</h3>
<br />
<span class="fa fa-facebook fa-3x"></span> <span class="fa fa-twitter fa-3x"></span> <span class="fa fa-vimeo-square fa-3x"></span> <span class="fa fa-instagram fa-3x"></span>
</div>
</div>
</footer>
CSS:
footer{
width: 100%; min-height: 375px;
background-color: #3772ab;
border-top: 3px solid #1f3e5f;
padding: 30px;
color: #FFF;
}
footer .footerContainer{
width: 80%; height: 325px;
margin: 0 auto;
border: 3px solid #F00;
}
footer .footerLeft{
width: 45%;
padding: 0 10px 0 0;
margin: 0 10px 0 0;
float: left;
display: inline-block;
border: 3px solid #F00;
}
footer .footerRight{
width: 45%;
padding: 0 0 0 10px;
margin: 0 0 0 10px;
float: right;
display: inline-block;
border: 3px solid #F00;
}
#media screen and (max-width: 1225px) {
footer{
min-height: 500px;
width: 100%;
text-align:center;
margin: 0 auto;
border: 3px solid #F00;
}
footer .footerLeft{
width: 100%;
display: block;
color: #fff;
margin: 0 0 30px 0;
padding: 0;
border: 3px solid #F00;
float: none;
}
footer input[type=text], footer textarea{
display: block;
margin : 0 auto;
position:relative;
border: 3px solid #F00;
}
footer .footerRight{
width: 100%;
display: block;
margin: 0;
border: 3px solid #F00;
float: none;
}
}
footer input[type=text], footer textarea{
-webkit-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
-moz-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
padding: 10px;
background: #fff;
margin: 0 0 10px 0;
}

You need to add text-align: center to parent in this case I have added it to td
And remove display: block of footer input[type=text], footer textarea
Check this
td {
text-align: center
}
footer input[type=text], footer textarea{
/*display: block;*/}

Hey there #SavionSmith
I reformed the form by getting rid of tables and using a list, it's much easier and cleaner (try to avoid tables).
HTML:
<footer>
<div class="footerContainer">
<form name="contact" action="">
<div class="footerLeft">
<h2>CONTACT US</h2>
</div>
<ul >
<li id="li_1" >
<label class="description" for="name"> Field Required </label>
<div>
<input id="name" name="name" class="text-input" placeholder="Your Name" type="text" maxlength="255" value=""/>
</div>
</li> <li id="li_2" >
<label class="description" for="email"> Field Required </label>
<div>
<input id="email" name="email" class="text-input" placeholder="Your Email" type="text" maxlength="255" value=""/>
</div>
</li> <li id="li_3" >
<label class="description" for="comment">Field Required </label>
<div>
<textarea id="comment" name="comment" class="element textarea medium" placeholder="Your Message" ></textarea>
</div>
</li>
<li class="buttons">
<input style="border: none;width: auto;" class="button" id="submit_btn" type="submit" name="submit" value="Submit" />
</li>
</ul>
</form>
</div>
</footer>
CSS:
form textarea,
form input { width: 50%; }
form ul
{
font-size:100%;
list-style-type:none;
margin:0;
padding:0;
width:100%;
}
form li
{
display:block;
margin:0;
padding:4px 5px 2px 9px;
position:relative;
}
.buttons
{
clear:both;
display:block;
margin-top:10px;
}
h2, h3, label
{
text-align: center;
display: block;
}
form {
margin: 0 auto;
}
input, textarea
{
border: solid #ef2;
display: block;
margin: 0 auto;
}
footer{
background-color: #3772ab;
border-top: 3px solid #1f3e5f;
padding: 30px;
color: #FFF;
}
footer .footerContainer{
margin: 0 auto;
border: 3px solid #F00;
}
footer .footerLeft{
border: 3px solid #F00;
}
footer .footerRight{
width: 45%;
padding: 0 0 0 10px;
margin: 0 0 0 10px;
border: 3px solid #F00;
}
#media screen and (max-width: 1225px) {
footer{
min-height: 500px;
text-align:center;
margin: 0 auto;
border: 3px solid #F00;
}
footer .footerLeft{
color: #fff;
border: 3px solid #F00;
}
footer input[type=text], footer textarea{
display: block;
margin : 0 auto;
border: 3px solid #F00;
}
footer .footerRight{
display: block;
border: 3px solid #F00;
}
}
footer input[type=text], footer textarea{
-webkit-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
-moz-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
background: #fff;
}
JSFiddle: http://jsfiddle.net/Jhb9q/10/
The form will keep re-sizing while the browser window changes size!
The form input { width: 50%; } controls the width size of the inputs except the submits button because I tried to exclude it using style="border: none;width: auto;" in its tag.
Also I tried to make the text a little bit more flexible.
You can change the design using CSS as you want, Hope this helps!

Related

Why is this footer not displaced by these floated elements?

What I want is to make my page a little responsive for desktop browsers.
For example, when I decrease the width of the browser, the left and right portion of the page should be stacked over each other. Please check the code, you'll understand. The outerLeft and outerRight div are floated left and right respectively. When I decrease the width of browser, outerRight goes below outerLeft, which is good. But then the problem is with footer and copyright (last two divs at bottom) divs. These do not get displaced because of the outerRight div. I want them to be below outerRight. How can I do this?
HTML:
<body style="margin: 0px">
<div class="outer">
<div id="header"></div>
<div class="outerLeft">
<h1><a style="text-decoration: none; color: white;" href="login.php">WinkCage</a></h1>
<br />
<p>Instant Messaging web application</p>
</div>
<div class="outerRight">
<div class="loginform">
<form name="form2" method="post">
<table>
<tr>
<td><input type="text" name="uname" placeholder="Username" required/></td>
<td><input type="password" name="pass" placeholder="Password" required/></td>
<td><input id="logbutton" type="submit" name="sub" value="Login"/></td>
</tr>
</table>
</form>
<p><?php echo $loginerror; ?></p>
</div>
<div class="signform">
<form id="signupform" name="form1" method="post" enctype="multipart/form-data">
<table>
<tr>
<td><input type="text" name="name" placeholder="Enter your name" required /></td>
<td rowspan="3"><div class="propic"><img id="imgid" src="images/dp.png" /></div>
<input id="imgInput" type="file" name="image" required/></td>
</tr>
<tr>
<td><input type="text" name="username" placeholder="Enter username" required pattern="[a-zA-Z0-9]{6,}" title="The username must contain minimum 6 and ONLY alphanumeric characters."/></td>
</tr>
<tr>
<td><input id="digits" type="text" name="phone" maxlength="10" placeholder="Enter your phone no." pattern=".{10}" required title="Invalid entry. Minimum 10 digits are required."/></td>
</tr>
<tr>
<td><input id="typechange" type="password" name="password" maxlength="12" placeholder="Enter password" required pattern="[a-zA-Z0-9]{5,}" title="The password must contain at least 5 and ONLY alphanumeric characters."/>
<div id="seepass"></div></td>
<td><input type="submit" id="button" name="submit" value="Sign Up"></td>
</tr>
</table>
</form>
<div id="userexist"></div>
<div style="clear: both"></div>
</div>
</div>
<div style="clear: both"></div>
</div>
<div style="font-family: calibri; text-align: center; color: black; font-size: 16px; padding: 5px 0px 5px 0px;"><a style="text-decoration: none; color: black; display: block;" href="login.php">WinkCage © 2016</a></div>
<div style="height: 7px; box-shadow: 0px 0px 1px 1px grey; background-color: white; display: block"></div>
</body>
CSS:
html, body{
height: 100%;
background-color: aquamarine;
}
#header{
height: 20%;
}
.outer{
max-width: 1024px;
margin: 0 auto;
height: 94%;
display: block;
}
.outerLeft{
float: left;
width: 320px;
height: auto;
text-align: center;
margin-top: 145px;
padding-left: 50px;
}
.outerRight{
padding-left: 50px;
float: left;
width: auto;
height: auto;
}
.loginform{
height: auto;
width: 480px;
box-shadow: 0px 0px 15px 0px grey;
border-radius: 3px;
padding: 20px 20px 20px 23px;
background-color: white;
color: red;
}
.loginform input{
width: 187px;
height: 21px;
padding-left: 5px;
}
#logbutton{
background-color: #00CC66;
color: white;
font-weight: bold;
width: 70px;
height: 28px;
cursor: pointer;
}
.signform{
margin-top: 20px;
margin-left: 0px;
height: auto;
width: 480px;
box-shadow: 0px 0px 15px 0px grey;
border-radius: 3px;
padding: 20px 20px 10px 20px;
background-color: white;
}
.signform input{
width: 250px;
height: 24px;
font-size: 20px;
padding: 5px 10px 5px 10px;
margin-bottom: 10px;
}
#button{
background-color: #0099FF;
color: white;
width: 188px !important;
height: 41px !important;
border-radius: 4px;
border: 0px solid grey;
display: block;
font-weight: bold;
margin-left: 10px;
cursor: pointer;
box-shadow: inset 0px 0px 4px grey;
text-shadow: 1px 1px 2px black;
}
.propic{
height: 100px;
width: 100px;
margin: 0 auto;
border: 4px solid white;
box-shadow: 0px 0px 1px 1px grey;
border-radius: 2px;
background-color: grey;
}
#imgInput{
width: 187px !important;
height: 22px !important;
font-size: 14px;
padding: 0px;
margin-top: 10px;
margin-bottom: 10px;
background-color: #cccccc;
margin-left: 10px;
}
#imgid{
height: 100px;
width: 100px;
}
You need to give it a clear: both just this!
<div style="font-family: calibri;text-align: center;color: black;font-size: 16px;padding: 5px 0px 5px 0px;clear: both;"><a style="text-decoration: none; color: black; display: block;" href="login.php">WinkCage © 2016</a></div>
jsFiddle
Note: I suggest you to do not use inline-css
Not sure what you want..
Since you have an element with height 94% - I'd say you always want to see that footer (being fixed on the bottom..) and generate the scroll just for that outer element.
If that's what you want, you can just include an overflow: auto in the .outer class.
.outer {
max-width: 1024px;
margin: 0 auto;
height: 94%;
display: block;
overflow: auto;
}
Take a look here..
https://jsfiddle.net/uvqk4eeL/1/

css messed up (auto height) [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have a problem with a css style. It happen when I set height to auto website
access live view by diung this go to newproject.comli.com/post.php log in with a username = shining password = asdfgh123 and then manualy go to newproject.comli.com/details.php
so my div height gets set to 0 do not know why. I am talking about #itemsCategListsform could someone help me? Here is my code:
<div id="itemsCategListsform">
<div id="plink">
<div id="open">My details</div>
<div id="closed">My ads</div>
<div id="closed">Favorites</div>
</div>
<div id="pbase">
<div id="detailforms">
<p> Email:
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="email" name="email" size="30">
<input class="submit-buttonform" type="submit" name="updateemail" value="Update Email">
</form>
</p>
<p>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
Password: <br>
<input type="password" name="password" size="30"><br>
Re-Password: <br>
<input type="password" name="repassword" size="30">
<input class="submit-buttonform" type="submit" name="updatepassword" value="Update password" >
</form>
</p>
Phone:
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="text" name="phone" size="30">
<input class="submit-buttonform" type="submit" name="updatephone" value="Update phone">
</form>
Website:
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="text" name="website" size="30">
<input class="submit-buttonform" type="submit" name="updatewebsite" value="Update website">
</form>
</div>
</div>
</div>
and css :
#itemsCategListsform {
background-color: white;
position: relative;
width: 930px;
height: auto;
left: 175px;
top: 20px;
border-radius: 4px;
border: 1px solid #1a171a;
padding-top: 40px;
padding-left: 70px;
-webkit-box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.6);
-moz-box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.6);
box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.6);
}
#plink {
position: relative;
width: 200px;
float: left;
border-top: 1px solid black;
border-left: 1px solid black;
z-index: 10;
border-radius: 4px 0 0 4px;
-webkit-box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
-moz-box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
}
#open {
border-bottom: 1px solid black;
border-right: 1px solid #fbfbfe;
text-align: center;
line-height: 50px;
background-color: #fbfbfe;
}
#closed {
border-bottom: 1px solid black;
width: 200px;
text-align: center;
line-height: 50px;
}
#pbase {
border: 1px solid black;
background-color: #fbfbfe;
position: relative;
width: 600px;
height: auto;
float: left;
margin-left: -1px;
border-radius: 0px 4px 4px 4px;
-webkit-box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
-moz-box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
box-shadow: 3px 3px 5px -3px rgba(0,0,0,0.6);
}
#closed:hover a {
display: block;
background-color: #fbfbfe;
border-right: 1px solid black;
}
#open:hover a {
display: block;
}
#detailforms {
position: relative;
margin:0 auto;
top: 10px;
width: 450px;
height: auto;
margin-bottom: 40px;
}
The height is registering as 0 because the child element is floated. CSS float takes an element out of the flow of content and wraps inline elements around it.
Your problem is here:
<div id="itemsCategListsform">
<div id="plink">
...
#plink{ float: left; }
#phase{ float: left; }
I'd recommend adding a pseudo element after the parent with clear: both set.
<div id="itemsCategListsform" class="clearfix">
<div id="plink">
...
.clearfix:after {
content: " ";
display: block;
height: 0;
clear: both;
}
See some additional solutions here.
Add display: inline-block to the css of itemsCategListsform :)
okay with a help of DACrosby was solved easily as he said that because of float left and to solve that i just add overflow: auto; tell me if i did good or there is better solution cuz this was really easy and seems to be okay everything

Text input box side by side not aligning in css3

I require 2 text input boxes side by side in one page using css3. I have everything ready except that the second box is coming below the first input box. How can i correct this in css.
html:
<div class="main">
<div class="one">
<div class="register">
<h3>Create your account</h3>
<form id="reg-form">
<div>
<div>
<label for="username">Username</label>
<input type="text" id="username" spellcheck="false" placeholder="User Name" />
</div>
<div>
<label for="password">Password</label>
<input type="password" id="password" />
</div>
<div>
<label></label>
<input type="submit" value="Shop Login" id="create-account" class="button"/>
</div>
</form>
</div>
</div>
<div class="two">
<div class="register">
<h3>Create your account</h3>
<form id="reg-form1">
<div>
<label for="name1">Name</label>
<input type="text" id="name1" spellcheck="false" placeholder="Enter Your Name"/>
</div>
<div>
<label for="email1">Email</label>
<input type="text" id="email1" spellcheck="false" placeholder="mymail#mail.com"/>
</div>
<div>
<label for="username1">Username</label>
<input type="text" id="username1" spellcheck="false" placeholder="User Name" />
</div>
<div>
<label for="password1">Password</label>
<input type="password" id="password1" />
</div>
<div>
<label for="password-again1">Password Again</label>
<input type="password" id="password-again1" />
</div>
<div>
<label></label>
<input type="submit" value="Create Account" id="create-account1" class="button"/>
</div>
</form>
</div>
</div>
</div>
CSS
.main > div {
display: inline-block;
width: 49%;
margin-top: 10px;
}
.two .register {
border: none;
}
.two .register h3 {
border-bottom-color: #909090;
}
.two .register .sep {
border-color: #909090;
}
.register {
width: 400px;
margin: 10px auto;
padding: 10px;
border: 7px solid #ADD8E6;
border-radius: 10px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #444;
background-color: #f0f0f0;
box-shadow: 0 0 20px 0 #000000;
}
.register h3 {
margin: 0 15px 20px;
border-bottom: 2px solid #72b372;
padding: 5px 10px 5px 0;
font-size: 1.1em;
}
.register div {
margin: 0 0 15px 0;
border: none;
}
.register label {
display: inline-block;
width: 25%;
text-align: right;
margin: 10px;
}
.register input[type=text], .register input[type=password] {
width: 65%;
font-family: "Lucida Grande","Lucida Sans Unicode",Tahoma,Sans-Serif;
padding: 5px;
font-size: 0.9em;
border-radius: 5px;
background: rgba(0, 0, 0, 0.07);
}
.register input[type=text]:focus, .register input[type=password]:focus {
background: #FFFFFF;
}
.register .button {
font-size: 1em;
border-radius: 8px;
padding: 10px;
border: 1px solid #ADD8E6;
box-shadow: 0 1px 0 0 #05B8CC inset;
background: #05B8CC;
background: -webkit-linear-gradient(#ADD8E6, #05B8CC);
background: -moz-linear-gradient(#ADD8E6, #05B8CC);
background: -o-linear-gradient(#ADD8E6, #05B8CC);
background: linear-gradient(#ADD8E6, #05B8CC);
}
.register .button:hover {
background: #51db1c;
background: -webkit-linear-gradient(#51db1c, #6ba061);
background: -moz-linear-gradient(#51db1c, #6ba061);
background: -o-linear-gradient(#51db1c, #6ba061);
background: linear-gradient(#51db1c, #6ba061);
}
.register .sep {
border: 1px solid #72b372;
position: relative;
margin: 35px 20px;
}
.register .or {
position: absolute;
width: 50px;
left: 50%;
background: #f0f0f0;
text-align: center;
margin: -10px 0 0 -25px;
line-height: 20px;
}
.register .connect {
width: 400px;
margin: 0 auto;
text-align: center;
}
I have provided a jsFiddle Demo
I require it aligned side by side rather than top bottom as in demo. Thanks in advance
You have missed a closing div before <div class="two">.
Adding the closing div will make both forms next to each other.
Then you need to add a little CSS rule to make both forms perfectly aligned vertically:
div.one {
position: relative;
top: -165px
}
See the demo here: http://jsfiddle.net/t5SNE/7/

Making my form responsive according the sprites

I can use all the help with making my contact form responsive according the eagle sprite I have on this page: http://demo.chilipress.com/epic3/
The idea is to have the eagle's mouth over the form while the screen gets resized.
As you can see, the sprites are completely responsive and so is the form. However the form does not stick to the eagle's mouth when resizing.
HTML:
<section id="two" class="window">
<img src="assets/contact.jpg" alt="background image">
<div id="sprite1_contact"></div>
<div id="sprite2_contact"></div>
<div id="content">
<div class="contact">
<form>
<fieldset class="name group">
<label for="name" class="name">Name</label>
<input id="name" name="name" required aria-required=”true” pattern="[A-Za-z-0-9]+\s[A-Za-z]+" title="firstname lastname"/>
</fieldset>
<fieldset class="email group">
<label for="email" class="email">Email</label>
<input type="email" id="email" name="email" required title="Submit a valid Email">
</fieldset>
<fieldset class="phone group">
<label for="phone" class="phone">Telephone</label>
<input type="tel" id="phone" name="phone" pattern="(\+?\d[- .]*){7,17}" required title="Submit an international, national or local phone number"/>
</fieldset>
<fieldset class="message group">
<label class="message">Message</label>
<input type="text" id="message" required/>
</fieldset>
<fieldset class="send group">
<input type="submit" value="Send" class="sendButton">
</fieldset>
</form>
</div>
</div>
</section>
CSS
#sprite1_contact{
background-image: url('sprite_contact2.png');
width: 35.2%;
height: 0;
padding-bottom: 7%;
background-position: 0 0;
background-size: 100%;
display: block;
top: 0;
position: absolute;
margin: 0 0 0 32.3%;
z-index: 2;}
#sprite2_contact {
background-image: url('sprite_contact2.png');
width: 27.5%;
height: 0;
padding-bottom: 29%;
background-position: 0 27%;
background-size: 100%;
display: block;
top: 0;
position: absolute;
margin: 0 0 0 35.8%;
z-index: 1;}
#content{
max-width: 50.694%;
position: absolute;
bottom: 0;
background: none repeat scroll 0 0 rgba(0, 0, 0, .55);
border-radius: 13px;
width: 678px;
margin: 0 0 7.6% 25.9167%;
box-shadow: 0 0 0 2px #000000, 2px 2px 30px 1px rgba(199, 255, 100, 0.73);}
.contact{
width: 100%;
margin: 10px;}
fieldset{
border: 0;
margin: 0;
width: 100%;
padding: 1%;}
.name, .email, .message{
padding-right: 29px;}
label{
color: #d8d9de;
font-family:'apple_chancerychancery';
font-size: 1.2em;
padding-left: 10px;}
input{
margin-right: 50px;
padding: 5px;
text-align: left;
border-radius: 10px;
background: none repeat scroll 0 0 rgba(255, 240, 260, 0.5);}
#name, #email, #phone, #message{
float: right;
color: #253c93;
text-decoration: none;
border: 1px dotted #29FF00;
font-family: 'Calibri', Arial, sans-serif;
font-size: 1em;
width: 73%;}
#name{
width: 73.5%;}
textarea {vertical-align: top;}
div#inner-editor{
padding: 30px;}
#message{
padding-top: 10%;}
.sendButton{
background: rgba(0, 0, 0, 0);
color: #d8d9de;
font-size: 1.2em;
font-family: 'apple_chancerychancery';
padding: 0.8% 4%;
border: none;
margin-left: 42%;
cursor: pointer;
box-shadow: inset 2px 2px 9px rgba(199, 255, 100, 0.73), inset -2px -2px 9px rgba(199, 255, 100, 0.73);}
Just 2 changes in the CSS:
#sprite2_contact {
top: 0px !important;
}
just to overcome the top that is inline ..
and
#content {
margin-top: 28%;
}
Well, you have already a margin property there, just place that afterwards so that the other is overwritten
I have set those changes this way, instead of changing yours, so the changes can be more easily seen and reverted

CSS style wont apply in text input boxes

I am having trouble with applying a style in my input box.
I have header.css here
#charset "utf-8";
body, h1, h2, h3, h4, h5, h6, p, div, ul, li {
margin:0;
padding:0;
}
body { font family: Verdana; background-color: #FFFFFF }
#Wrapper {
width: auto;
height:2000px;
margin: 0 auto;
}
#divHeader {
position:0px;
width: 100%;
height: 180px;
background:url(thisheader/header_1.png)
}
#divHeader2 {
position: 180px;
width: 100%;
height: 200px;
background: url(thisheader/SMCFIbanner.png);
}
#box {
background: white;
border: 1px solid #DDD;
border-radius: 1px;
box-shadow: 0 0 3px #DDD inset;
color: #666;
padding: 5px 10px;
width: 185px;
outline: none;
}
when I try to apply the style to the textbox for the password and username using the header.css, it wont apply. I created a new css file just to check, yes.css:
input#box {
background: white;
border: 1px solid #DDD;
border-radius: 1px;
box-shadow: 0 0 3px #DDD inset;
color: #666;
padding: 5px 10px;
width: 165px;
outline: none;
}
log.php
<div>
<form method="post" action="checkLogin.php">
<label>Username</label>
<input type="text" value="" name="myusername" size="20%" class="input_field" title="username" id="box" />
<br>
<br>
<label>Password</label>
<input type="password" value="" name="mypassword" class="input_field" title="password" id="box" />
<br>
<br>
<input type="submit" name="login" value="Login" alt="login" id="submit_btn" title="Login" />
</form>
</div>
and when i try to link this one in my log.php, it worked.
what might be the problem ?
First off, you should not have multiple elements on page with the same id. In this case, both your login and password fields have an ID of "box". Use class instead. You may be better off doing:
<div id='box'>
<form method="post" action="checkLogin.php">
<label>Username</label>
<input type="text" value="" name="myusername" size="20%" class="input_field" title="username" />
<br>
<br>
<label>Password</label>
<input type="password" value="" name="mypassword" class="input_field" title="password"/>
<br>
<br>
<input type="submit" name="login" value="Login" alt="login" id="submit_btn" title="Login" />
</form>
</div>
Then, in the css, do
#box input[type='text']{
blah,blah,blah...
}
The problem could be that you have two elements with the same id.
By the way, you can select to apply the style to all input textfields with this selector.
form input[type=text] {
background: white;
border: 1px solid #DDD;
border-radius: 1px;
box-shadow: 0 0 3px #DDD inset;
color: #666;
padding: 5px 10px;
width: 165px;
outline: none;
}
Try styling the input box like this:
input[type=text] {
background: white;
border: 1px solid #DDD;
border-radius: 1px;
box-shadow: 0 0 3px #DDD inset;
color: #666;
padding: 5px 10px;
width: 185px;
outline: none;
}