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;
}
Related
Here, I am trying to change the background color of the input after I write something in the textbox. Whenever I focus, then it will change the background color to white and it will remain white for the rest of time.
<input type="text" class="
.contact-form input,
.contact-form textarea {
width: 100%;
height: 50px;
margin: 10px 0;
background-color: #353b48;
border: none;
outline: none;
padding: 20px;
border-radius: 4px;
color: #fff;
}
.contact-form input:focus {
width: 100%;
height: 50px;
margin: 10px 0;
background-color: #353b48;
border: none;
outline: none;
padding: 20px;
border-radius: 4px;
color: #fff;
background-color: white;
border: 2px solid;
border-color: #207398;
}
<input type="text" class="nameZone" name="name" placeholder="Your Full Name" style="color: black;">
<input type="email" class="emailZone" name="email" placeholder="Your Email" style="color: black;">
<input type="text" class="subjectZone" name="subject" placeholder="Subject" style="color: black;">
<textarea class="messageZone" name="message" placeholder="Message" style="color: black;"></textarea>
Remark: The top part of code is broken?
However, I've assumed you want to kept the gray-ish background while typing in data. I think you could use !important. The :focus part shall be redundant.
.contact-form input, .contact-form textarea {
background-color: #353b48 !important;
}
Snippet is the part of updated code. Btw, your inline css color:black has overrule the internal css color:white.
.contact-form input, .contact-form textarea {
width: 100%;
height: 50px;
margin: 10px 0;
background-color: #353b48 !important;
border: none;
outline: none;
padding: 20px;
border-radius: 4px;
color: #fff;
}
<div class="contact-form">
<input type="text" class="nameZone contact-form" name="name" placeholder="Your Full Name" style="color: black;">
<textarea class="messageZone" name="message" placeholder="Message" style="color: black;"></textarea>
</div>
.contact-form {
transition: .3s;
margin-top: 120px;
/*border: 2px solid black;*/
background-color: rgb(243, 243, 243);
border-radius: 6px;
box-shadow: -4px 12px 11px 5px rgba(0, 0, 0, 0.521);
width: 475px;
height: 550px;
margin-left: 11px;
text-align: left;
align-items: center;
position: sticky;
left: 60%;
top: -20%;
user-select: all;
z-index: 4;
}
.benefit-card {
margin: 20px;
background-color: white;
text-align: center;
border: 1px solid black;
width: 300px;
height: 450px;
top: 0%;
left: 22%;
box-shadow: 2px 2px 12px 2px black;
user-select: none;
}
.benefit-card-header {
border-bottom: 3px dotted black;
padding-bottom: 11px;
}
.benefit-card-image {
-webkit-user-drag: none;
padding-top: 11px;
padding-bottom: 19px;
width: 200px;
filter: drop-shadow(2px 2px 6px black);
}
#help-me {
position: relative;
z-index: 8;
margin-top: -515px;
}
<div class="contact-form">
<h2 class="contact-form-header">Get Your Quote Today!</h2>
<form class="form-bg-pls-send-help">
<label class="contact-input-header" for="email">Email<span class="important-contact-field"> *</span></label>
<br>
<input class="contact-input" name="email" type="email" autocomplete="off" required placeholder="Your company email" />
<label class="contact-input-header" for="company">Company</label>
<br>
<input class="contact-input" name="company" type="text" required placeholder="Who do you work for?" />
<label class="contact-input-header" for="subject">Subject</label>
<input class="contact-input" name="subject" type="text" placeholder="Subject " />
<label class="contact-input-header" for="about">About</label>
<textarea class="long-input contact-input" name="about" type="text" placeholder="What does your company do?"></textarea>
<br><br>
<input class="getquote-button" type="submit" value="Get Quote" />
</form>
</div>
<div id="help-me">
<div class="benefit-card" id="bc">
<h1 class="benefit-card-header" id="bch">World Wide</h1>
<h3 class="benefit-card-description" id="bcd">No matter where you're from or where you're located we will help you grow your company!</h3>
</div>
</div>
I am building a sample website of a company. I have a contact form set up, but the inputs are not clickable when they are in a div tag, but I need the form in one so I can properly style the form.
The form is supposed to require the input, when I click on the Get Quote button it allows me to edit the first input tag. This has never happened to me before and I have tried user-select, checking if the disabled attribute was used, and just about everything I can think of.
Update your css file to:
#help-me{
position: relative;
z-index: -1;
margin-top: -515px;
}
This element is covering the whole screen.
Update the z-index when you need to show it.
Your inputs are not clickable because #help-me covers all of .contact-form due to the way you have used margin-top to position it higher compared to where it would naturally sit.
Consider using flexbox to achieve your layout instead.
.layout {
display: flex
}
.contact-form {
flex: 1 1 auto;
background-color: rgb(243, 243, 243);
border-radius: 6px;
box-shadow: -4px 12px 11px 5px rgba(0, 0, 0, 0.521);
}
#help-me {
flex: 1 1 auto;
}
<div class="layout">
<div id="help-me">
#help-me
</div>
<div class="contact-form">
.contact-form
</div>
</div>
Could someone help me? I am with this form trying to centralize all fields in it. I've tried a bunch of different stuff, and I've noticed that the code works differently inside the theme that I am using. Is there another way to do it rather than margin: 0 auto;? Any help will be really appreciated. Here is the url. Thank you
<div id="instant-quote-form">
<form action="http://natesolutions.vonigo.com/external/" accept-charset="UTF-8" method="get" onsubmit="return submitForm(this)">
<div class="instant-quote">
<h3 class="quote-title">Instant Online Quote</h3>
</div>
<div class="house-type">
<input type="radio" onclick="showServices(this)" id="xclientTypeID" name="xclientTypeID" value="1" checked />Residential
<input type="radio" onclick="showServices(this)" id="xclientTypeID" name="xclientTypeID" value="2" />Commercial
</div>
<div class="zip-code">
<input type="text" id="zip" name="zip" value="" placeholder="Enter Postal Code"/>
</div>
<div class="house-size" id="divServices1">
<select id="xserviceTypeID1" onchange="changeService(this)">
<option value="14" selected>Small House (1200-2000sq.ft)</option>
<option value="17">Medium House (2001-2800sq.ft)</option>
<option value="18">Large House (2801-3500sq.ft)</option>
<option value="19">XL House (3500+)</option>
</select>
</div>
<div class="button-go">
<input type="submit" value="Go" />
</div>
<input type="hidden" id="xserviceTypeID2" value="20" />
<input type="hidden" id="xserviceTypeID5" value="20" />
<input type="hidden" id="clientTypeID" name="clientTypeID" value="1" />
<input type="hidden" id="serviceTypeID" name="serviceTypeID" value="14" />
</form>
</div>
<style>
#instant-quote-form {
width: 100%;
margin: 0 auto;
}
.instant-quote {
float: left;
margin: 20px 5px;
padding-top: 4px;
}
.house-type {
float: left;
margin: 20px 5px;
color: #ffffff;
font-size: 16px;
padding-top: 5px;
}
.zip-code {
float: left;
margin: 20px 5px;
border: 1px solid #ffffff;
border-radius: 3px;
color: #000000;
}
.house-size {
float: left;
margin: 20px 5px;
border: 1px solid #ffffff;
border-radius: 3px;
color: #000000;
}
select#xserviceTypeID1 {
border: 1px solid #ffffff;
font-size: 13px;
padding: 10px;
color: #000000;
}
.button-go {
float: left;
margin: 20px 5px;
}
h3.quote-title {
margin-bottom: 0;
color: #ffffff;
}
input#zip {
margin-bottom: 0;
border: 1px solid #ffffff;
font-size: 13px;
padding: 9px;
}
input#zip::placeholder {
color: #000000;
}
input[type=text]::placeholder {
color: #000000;
}
input#xclientTypeID {
margin: 0 5px;
}
input[type="submit"] {
height: 37px;
width: 50px;
background: #55b948;
color: #fff;
border-radius: 3px;
text-transform: uppercase;
border: 1px solid #55b948;
font-weight: bold;
}
</style>
As your #instant-quote-form is as wide as its parent, centering this element will not do anything. What you will need to do is to center the <form> inside of its container. This can be done by applying display:flex to #instant-quote-form and then margin:0 auto to #instant-quote-form > form:
#instant-quote-form {
display: flex;
}
#instant-quote-form > form {
margin: 0 auto;
}
Try enclosing your <form> within <center> tag
Additionally, If you want the form with elements in a vertically aligned fashion then set float to none for each direct child of your <form>
If this isn't what you were looking for, please elaborate your issue and expected outcome.
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/
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!