I'm having trouble reformatting this form, two of the fields overlap in the middle and I can't for the life of me figure out why, or how to fix it. The form itself works perfectly fine, it's just the alignment that's wrong. I'm not sure if the new CSS doesn't like the spray fields and that's causing the issue. I applied this style to a couple of other forms on our site and they swapped over without a hitch, it's just been this one fighting me. I've tried using <br> and that doesn't change the issue
.form-2 {
font-family: 'Ubuntu', 'Lato', sans-serif;
font-weight: 400;
/* Size and position */
width: 650px;
position: relative;
margin: 20px auto 30px;
padding: 10px;
overflow: hidden;
/* Styles */
background: #111;
border-radius: 0.4em;
border: 1px solid #191919;
box-shadow:
inset 0 0 2px 1px rgba(255,255,255,0.08),
0 16px 10px -8px rgba(0, 0, 0, 0.6);
}
.form-2 label {
/* Size and position */
width: 20%;
float: left;
padding-top: 9px;
/* Styles */
color: #ddd;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 1px;
text-shadow: 0 1px 0 #000;
text-indent: 10px;
font-weight: 700;
cursor: pointer;
}
.form-2 input[type=text],
.form-2 input[type=password] {
/* Size and position */
width: 60%;
float: left;
padding: 8px 5px;
margin-bottom: 10px;
font-size: 12px;
/* Styles */
background: #1f2124; /* Fallback */
background: -moz-linear-gradient(#1f2124, #27292c);
background: -ms-linear-gradient(#1f2124, #27292c);
background: -o-linear-gradient(#1f2124, #27292c);
background: -webkit-gradient(linear, 0 0, 0 100%, from(#1f2124), to(#27292c));
background: -webkit-linear-gradient(#1f2124, #27292c);
background: linear-gradient(#1f2124, #27292c);
border: 1px solid #000;
box-shadow:
0 1px 0 rgba(255,255,255,0.1);
border-radius: 3px;
/* Font styles */
font-family: 'Ubuntu', 'Lato', sans-serif;
color: #fff;
}
.form-2 input[type=text]:hover,
.form-2 input[type=password]:hover,
.form-2 label:hover ~ input[type=text],
.form-2 label:hover ~ input[type=password] {
background: #27292c;
}
.form-2 input[type=text]:focus,
.form-2 input[type=password]:focus {
box-shadow: inset 0 0 2px #000;
background: #494d54;
border-color: #986893;
border-width: 2px;
outline: none; /* Remove Chrome outline */
}
.form-2 p:nth-child(3),
.form-2 p:nth-child(4) {
float: left;
width: 50%;
}
.form-2 label[for=remember] {
width: auto;
float: none;
display: inline-block;
text-transform: capitalize;
font-size: 11px;
font-weight: 400;
letter-spacing: 0px;
text-indent: 2px;
}
.form-2 input[type=checkbox] {
margin-left: 10px;
vertical-align: middle;
}
.form-2 input[type=submit] {
/* Width and position LOGIN BUTTON*/
width: 35%;
padding: 8px 5px;
/* Styles */
border: 1px solid #0273dd; /* Fallback */
border: 1px solid rgba(0,0,0,0.4);
box-shadow:
inset 0 1px 0 rgba(255,255,255,0.3),
inset 0 10px 10px rgba(255,255,255,0.1);
border-radius: 3px;
background: #6C2866;
cursor:pointer;
/* Font styles */
font-family: 'Ubuntu', 'Lato', sans-serif;
color: white;
font-weight: 700;
font-size: 18px;
text-shadow: 0 -1px 0 rgba(0,0,0,0.8);
}
.form-2 input[value=Register] {
/* Width and position REGISTER BUTTON*/
width: 35%;
padding: 8px 5px;
/* Styles */
border: 1px solid #0273dd; /* Fallback */
border: 1px solid rgba(0,0,0,0.4);
box-shadow:
inset 0 1px 0 rgba(255,255,255,0.3),
inset 0 10px 10px rgba(255,255,255,0.1);
border-radius: 3px;
background: #6C2866;
cursor:pointer;
/* Font styles */
font-family: 'Ubuntu', 'Lato', sans-serif;
color: white;
font-weight: 700;
font-size: 18px;
text-shadow: 0 -1px 0 rgba(0,0,0,0.8);
}
.form-2 .Reset {
/* Width and position REGISTER BUTTON*/
width: 40%;
padding: 8px 5px;
/* Styles */
border: 1px solid #0273dd; /* Fallback */
border: 1px solid rgba(0,0,0,0.4);
box-shadow:
inset 0 1px 0 rgba(255,255,255,0.3),
inset 0 10px 10px rgba(255,255,255,0.1);
border-radius: 3px;
background: #6C2866;
cursor:pointer;
/* Font styles */
font-family: 'Ubuntu', 'Lato', sans-serif;
color: white;
font-weight: 700;
font-size: 18px;
text-shadow: 0 -1px 0 rgba(0,0,0,0.8);
}
.form-2 input[type=submit]:hover {
box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}
.form-2 input[type=submit]:active {
background: #287db5;
box-shadow: inset 0 0 3px rgba(0,0,0,0.6);
border-color: #000; /* Fallback */
border-color: rgba(0,0,0,0.9);
}
.no-boxshadow .form-2 input[type=submit]:hover {
background: #2a92d8;
}
.form-2:after {
/* Size and position */
content: "";
height: 1px;
width: 33%;
position: absolute;
left: 20%;
top: 0;
/* Styles */
background: -moz-linear-gradient(left, transparent, #444, #b6b6b8, #444, transparent);
background: -ms-linear-gradient(left, transparent, #444, #b6b6b8, #444, transparent);
background: -o-linear-gradient(left, transparent, #444, #b6b6b8, #444, transparent);
background: -webkit-gradient(linear, 0 0, 100% 0, from(transparent), color-stop(0.25, #444), color-stop(0.5, #b6b6b8), color-stop(0.75, #444), to(transparent));
background: -webkit-linear-gradient(left, transparent, #444, #b6b6b8, #444, transparent);
background: linear-gradient(left, transparent, #444, #b6b6b8, #444, transparent);
}
.form-2:before {
/* Size and position */
content: "";
width: 8px;
height: 5px;
position: absolute;
left: 34%;
top: -7px;
/* Styles */
border-radius: 50%;
box-shadow: 0 0 6px 4px #fff;
}
.form-2 p:nth-child(1):before{
/* Size and position */
content:"";
width:250px;
height:100px;
position:absolute;
top:0;
left:45px;
/* Styles */
-webkit-transform: rotate(75deg);
-moz-transform: rotate(75deg);
-ms-transform: rotate(75deg);
-o-transform: rotate(75deg);
transform: rotate(75deg);
background: -moz-linear-gradient(50deg, rgba(255,255,255,0.15), rgba(0,0,0,0));
background: -ms-linear-gradient(50deg, rgba(255,255,255,0.15), rgba(0,0,0,0));
background: -o-linear-gradient(50deg, rgba(255,255,255,0.15), rgba(0,0,0,0));
background: -webkit-linear-gradient(50deg, rgba(255,255,255,0.15), rgba(0,0,0,0));
background: linear-gradient(50deg, rgba(255,255,255,0.15), rgba(0,0,0,0));
pointer-events:none;
}
.no-pointerevents .form-2 p:nth-child(1):before {
display: none;
}
<center>
<h1><font color="red">User Registration</font></h1>
</center>
<section class="main">
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>" class="form-2">
<p class="clearfix">
<br />
<label for="Username">Username</label>
<span id="sprytextfield3">
<input type="text" name="Username" id="Username" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span>
</p>
<p class="clearfix">
<label for="Password">Password</label>
<span id="sprytextfield2">
<input type="password" name="Password" id="Password" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span>
</p>
<p class="clearfix">
<label for="passval">Confirm Password</label>
<span id="spryconfirm1">
<input type="password" name="passval" id="passval" />
<span class="confirmRequiredMsg">Required.</span><span class="confirmInvalidMsg">The values don't match.</span></span>
</p>
<p class="clearfix">
<label for="EmailAddress">Email Address</label>
<span id="sprytextfield1">
<input type="text" name="EmailAddress" id="EmailAddress" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span>
</p>
<p class="clearfix">
<label for="Security">What is your favorite food?</label>
<span id="sprytextfield4">
<input type="text" name="Security" id="Security" />
<span class="textfieldRequiredMsg">A value is required.</span></span>
<br />
</p>
<br /><br />
<input type="submit" name="SubmitUserForm" id="SubmitUserForm" value="submit" />
</p>
<input type="hidden" name="MM_insert" value="form1" />
<br /><br /><br />
There was some style in your form
.form-2 p:nth-child(3),
.form-2 p:nth-child(4) {
float: left;
width: 50%;
}
They have 50% width, that's why there have another 50% of the width, for that reason they were overlapping
.form-2 {
font-family: 'Ubuntu', 'Lato', sans-serif;
font-weight: 400;
/* Size and position */
width: 650px;
position: relative;
margin: 20px auto 30px;
padding: 10px;
overflow: hidden;
/* Styles */
background: #111;
border-radius: 0.4em;
border: 1px solid #191919;
box-shadow:
inset 0 0 2px 1px rgba(255,255,255,0.08),
0 16px 10px -8px rgba(0, 0, 0, 0.6);
}
.form-2 label {
/* Size and position */
width: 20%;
float: left;
padding-top: 9px;
/* Styles */
color: #ddd;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 1px;
text-shadow: 0 1px 0 #000;
text-indent: 10px;
font-weight: 700;
cursor: pointer;
}
.form-2 input[type=text],
.form-2 input[type=password] {
/* Size and position */
width: 60%;
float: left;
padding: 8px 5px;
margin-bottom: 10px;
font-size: 12px;
/* Styles */
background: #1f2124; /* Fallback */
background: -moz-linear-gradient(#1f2124, #27292c);
background: -ms-linear-gradient(#1f2124, #27292c);
background: -o-linear-gradient(#1f2124, #27292c);
background: -webkit-gradient(linear, 0 0, 0 100%, from(#1f2124), to(#27292c));
background: -webkit-linear-gradient(#1f2124, #27292c);
background: linear-gradient(#1f2124, #27292c);
border: 1px solid #000;
box-shadow:
0 1px 0 rgba(255,255,255,0.1);
border-radius: 3px;
/* Font styles */
font-family: 'Ubuntu', 'Lato', sans-serif;
color: #fff;
}
.form-2 input[type=text]:hover,
.form-2 input[type=password]:hover,
.form-2 label:hover ~ input[type=text],
.form-2 label:hover ~ input[type=password] {
background: #27292c;
}
.form-2 input[type=text]:focus,
.form-2 input[type=password]:focus {
box-shadow: inset 0 0 2px #000;
background: #494d54;
border-color: #986893;
border-width: 2px;
outline: none; /* Remove Chrome outline */
}
.form-2 label[for=remember] {
width: auto;
float: none;
display: inline-block;
text-transform: capitalize;
font-size: 11px;
font-weight: 400;
letter-spacing: 0px;
text-indent: 2px;
}
.form-2 input[type=checkbox] {
margin-left: 10px;
vertical-align: middle;
}
.form-2 input[type=submit] {
/* Width and position LOGIN BUTTON*/
width: 35%;
padding: 8px 5px;
/* Styles */
border: 1px solid #0273dd; /* Fallback */
border: 1px solid rgba(0,0,0,0.4);
box-shadow:
inset 0 1px 0 rgba(255,255,255,0.3),
inset 0 10px 10px rgba(255,255,255,0.1);
border-radius: 3px;
background: #6C2866;
cursor:pointer;
/* Font styles */
font-family: 'Ubuntu', 'Lato', sans-serif;
color: white;
font-weight: 700;
font-size: 18px;
text-shadow: 0 -1px 0 rgba(0,0,0,0.8);
}
.form-2 input[value=Register] {
/* Width and position REGISTER BUTTON*/
width: 35%;
padding: 8px 5px;
/* Styles */
border: 1px solid #0273dd; /* Fallback */
border: 1px solid rgba(0,0,0,0.4);
box-shadow:
inset 0 1px 0 rgba(255,255,255,0.3),
inset 0 10px 10px rgba(255,255,255,0.1);
border-radius: 3px;
background: #6C2866;
cursor:pointer;
/* Font styles */
font-family: 'Ubuntu', 'Lato', sans-serif;
color: white;
font-weight: 700;
font-size: 18px;
text-shadow: 0 -1px 0 rgba(0,0,0,0.8);
}
.form-2 .Reset {
/* Width and position REGISTER BUTTON*/
width: 40%;
padding: 8px 5px;
/* Styles */
border: 1px solid #0273dd; /* Fallback */
border: 1px solid rgba(0,0,0,0.4);
box-shadow:
inset 0 1px 0 rgba(255,255,255,0.3),
inset 0 10px 10px rgba(255,255,255,0.1);
border-radius: 3px;
background: #6C2866;
cursor:pointer;
/* Font styles */
font-family: 'Ubuntu', 'Lato', sans-serif;
color: white;
font-weight: 700;
font-size: 18px;
text-shadow: 0 -1px 0 rgba(0,0,0,0.8);
}
.form-2 input[type=submit]:hover {
box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}
.form-2 input[type=submit]:active {
background: #287db5;
box-shadow: inset 0 0 3px rgba(0,0,0,0.6);
border-color: #000; /* Fallback */
border-color: rgba(0,0,0,0.9);
}
.no-boxshadow .form-2 input[type=submit]:hover {
background: #2a92d8;
}
.form-2:after {
/* Size and position */
content: "";
height: 1px;
width: 33%;
position: absolute;
left: 20%;
top: 0;
/* Styles */
background: -moz-linear-gradient(left, transparent, #444, #b6b6b8, #444, transparent);
background: -ms-linear-gradient(left, transparent, #444, #b6b6b8, #444, transparent);
background: -o-linear-gradient(left, transparent, #444, #b6b6b8, #444, transparent);
background: -webkit-gradient(linear, 0 0, 100% 0, from(transparent), color-stop(0.25, #444), color-stop(0.5, #b6b6b8), color-stop(0.75, #444), to(transparent));
background: -webkit-linear-gradient(left, transparent, #444, #b6b6b8, #444, transparent);
background: linear-gradient(left, transparent, #444, #b6b6b8, #444, transparent);
}
.form-2:before {
/* Size and position */
content: "";
width: 8px;
height: 5px;
position: absolute;
left: 34%;
top: -7px;
/* Styles */
border-radius: 50%;
box-shadow: 0 0 6px 4px #fff;
}
.form-2 p:nth-child(1):before{
/* Size and position */
content:"";
width:250px;
height:100px;
position:absolute;
top:0;
left:45px;
/* Styles */
-webkit-transform: rotate(75deg);
-moz-transform: rotate(75deg);
-ms-transform: rotate(75deg);
-o-transform: rotate(75deg);
transform: rotate(75deg);
background: -moz-linear-gradient(50deg, rgba(255,255,255,0.15), rgba(0,0,0,0));
background: -ms-linear-gradient(50deg, rgba(255,255,255,0.15), rgba(0,0,0,0));
background: -o-linear-gradient(50deg, rgba(255,255,255,0.15), rgba(0,0,0,0));
background: -webkit-linear-gradient(50deg, rgba(255,255,255,0.15), rgba(0,0,0,0));
background: linear-gradient(50deg, rgba(255,255,255,0.15), rgba(0,0,0,0));
pointer-events:none;
}
.no-pointerevents .form-2 p:nth-child(1):before {
display: none;
}
<center>
<h1><font color="red">User Registration</font></h1>
</center>
<section class="main">
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>" class="form-2">
<p class="clearfix">
<br />
<label for="Username">Username</label>
<span id="sprytextfield3">
<input type="text" name="Username" id="Username" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span>
</p>
<p class="clearfix">
<label for="Password">Password</label>
<span id="sprytextfield2">
<input type="password" name="Password" id="Password" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span>
</p>
<p class="clearfix">
<label for="passval">Confirm Password</label>
<span id="spryconfirm1">
<input type="password" name="passval" id="passval" />
<span class="confirmRequiredMsg">Required.</span><span class="confirmInvalidMsg">The values don't match.</span></span>
</p>
<p class="clearfix">
<label for="EmailAddress">Email Address</label>
<span id="sprytextfield1">
<input type="text" name="EmailAddress" id="EmailAddress" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span><span class="textfieldMinCharsMsg">Minimum number of characters not met.</span><span class="textfieldMaxCharsMsg">Exceeded maximum number of characters.</span></span>
</p>
<p class="clearfix">
<label for="Security">What is your favorite food?</label>
<span id="sprytextfield4">
<input type="text" name="Security" id="Security" />
<span class="textfieldRequiredMsg">A value is required.</span></span>
<br />
</p>
<br /><br />
<input type="submit" name="SubmitUserForm" id="SubmitUserForm" value="submit" />
</p>
<input type="hidden" name="MM_insert" value="form1" />
<br /><br /><br />
Related
I'm having trouble with a search box that has a dropdown. In the dropdown there are links but to open the links I have to double click them. Here is a link to my jsfiddle of it https://jsfiddle.net/ag7L02u0/. Anyone have a solution?
HTML:
<form class="search" method="post" action="" >
<input type="text" name="inputSearch" id="inputSearch" placeholder="Search Username" autocomplete="off" />
<ul class="search-ac" id="user-result">
<li>Search Result #2<br /><span>Description...</span></li>
<li>Search Result #3<br /><span>Description...</span></li>
<li>Search Result #4</li>
</ul>
<input type="submit" name="search" id="search" Style="display:none;">
</form>
CSS:
.search {
position: relative;
width: 300px;
float: right;
margin-top:5px;
}
.search input {
height: 26px;
width: 100%;
padding: 5px 12px 0px 25px;
background: white url("../img/search.png") 8px 6px no-repeat;
border: 1px solid;
border-color: #a8acbc #babdcc #c0c3d2;
-webkit-appearance: textfield;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-box-shadow: inset 0 1px #e5e7ed, 0 1px #fcfcfc;
box-shadow: inset 0 1px #e5e7ed, 0 1px #fcfcfc;
}
.search input:focus {
outline: 0;
border-color: #66b1ee;
-webkit-box-shadow: 0 0 2px rgba(85, 168, 236, 0.9);
box-shadow: 0 0 2px rgba(85, 168, 236, 0.9);
}
.search input:focus + .search-ac {
display: block;
}
.search-ac {
display: none;
position: absolute;
top: 35px;
left: 0;
right: 0;
z-index: 100;
background: #fdfdfd;
border: 1px solid;
border-color: #cbcfe2 #c8cee7 #c4c7d7;
border-radius: 3px;
background-image: -webkit-linear-gradient(top, #fdfdfd, #eceef4);
background-image: -moz-linear-gradient(top, #fdfdfd, #eceef4);
background-image: -o-linear-gradient(top, #fdfdfd, #eceef4);
background-image: linear-gradient(to bottom, #fdfdfd, #eceef4);
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
-webkit-padding-start: 0px;
}
.search-ac:hover {
display: block;
}
.search-ac li {
display: block;
z-index: 100000;
}
.search-ac li:first-child {
margin-top: -1px;
}
.search-ac li:first-child:before, .search-ac li:first-child:after {
content: '';
display: block;
width: 0;
height: 0;
position: absolute;
left: 50%;
margin-left: -5px;
border: 5px outset transparent;
}
.search-ac li:first-child:before {
border-bottom: 5px solid #c4c7d7;
top: -11px;
}
.search-ac li:first-child:after {
border-bottom: 5px solid #fdfdfd;
top: -10px;
}
.search-ac li:first-child:hover:before, .search-ac li:first-child:hover:after {
display: none;
}
.search-ac li:last-child {
margin-bottom: -1px;
}
.search-ac a {
display: block;
position: relative;
margin: 0 -1px;
padding: 6px 40px 6px 10px;
color: #808394;
font-weight: 500;
text-decoration: none;
text-shadow: 0 1px white;
border: 1px solid transparent;
border-radius: 3px;
z-index:110;
}
.search-ac a span {
font-weight: 200;
}
.search-ac a:before {
content: '';
position: absolute;
top: 50%;
right: 10px;
margin-top: -9px;
width: 18px;
height: 18px;
background: url("../img/arrow.png") 0 0 no-repeat;
}
.search-ac a:hover {
color: white;
text-shadow: 0 -1px rgba(0, 0, 0, 0.3);
background: #338cdf;
border-color: #2380dd #2179d5 #1a60aa;
background-image: -webkit-linear-gradient(top, #59aaf4, #338cdf);
background-image: -moz-linear-gradient(top, #59aaf4, #338cdf);
background-image: -o-linear-gradient(top, #59aaf4, #338cdf);
background-image: linear-gradient(to bottom, #59aaf4, #338cdf);
-webkit-box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 1px rgba(0, 0, 0, 0.08);
box-shadow: inset 0 1px rgba(255, 255, 255, 0.2), 0 1px rgba(0, 0, 0, 0.08);
}
:-moz-placeholder {
color: #a7aabc;
font-weight: 200;
}
::-webkit-input-placeholder {
color: #a7aabc;
font-weight: 200;
line-height: 14px;
}
::-webkit-search-decoration,
::-webkit-search-cancel-button {
-webkit-appearance: none;
}
.lt-ie9 .search input {
line-height: 26px;
}
.btn-default{
float:right;
margin-top: -38px;
}
Have you tried changing your href attribute to something else than "#"?
I tried tour example and put there
<a href="http://stackoverflow.com" target="_">
works fine
Works for me? I just added www.google.com in the href and target="_blank" (so i didn't navigate away) and it re-directs. What are you doing with the links in your real document please.
Here's the code that works the right way only if you remove background: #a1a1a1; from the .sign-up form. But I need the background. Changing z-index doesn't help since -1 value is too small and 0 is to big.
How to fix this problem?
Thank You.
.sign-up__form {
width: 260px;
padding: 20px;
background: #fff;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
border-top: 5px solid #ff4e50;
top: 80px;
left: 0;
right: 0;
margin: auto;
position: absolute;
}
.register-switch {
height: 32px;
margin-bottom: 20px;
padding: 4px;
position: relative;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.register-switch-input {
display: none;
}
.register-switch-label {
float: left;
width: 50%;
line-height: 32px;
color: #fff;
text-align: center;
cursor: pointer;
}
.register-switch-label:after {
position: absolute;
content: "";
width: 100%;
height: 100%;
background: lightblue;
left: 0;
top: 0;
z-index: -1;
}
.register-switch-input:checked + .register-switch-label:after {
background: tomato;
}
.register-switch-input:checked + .register-switch-label {
font-weight: normal;
color: #666;
background: #fff;
border-radius: 2px;
background-image: -webkit-linear-gradient(top, #fefefe, #eeeeee);
background-image: -moz-linear-gradient(top, #fefefe, #eeeeee);
background-image: -o-linear-gradient(top, #fefefe, #eeeeee);
background-image: linear-gradient(to bottom, #fefefe, #eeeeee);
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.1);
}
<form name="sign-up" class="sign-up__form">
<div class="register-switch">
<input type="radio" name="sex" value="Male" id="sex-m" class="register-switch-input" checked>
<label for="sex-m" class="register-switch-label">Male</label>
<input type="radio" name="sex" value="Female" id="sex-f" class="register-switch-input">
<label for="sex-f" class="register-switch-label">Female</label>
</div>
</form>
You need to set a z-index on the .sign-up__form rule as well ..
.sign-up__form {
width: 260px;
padding: 20px;
background: #fff;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
border-top: 5px solid #ff4e50;
top: 80px;
left: 0;
right: 0;
margin: auto;
position: absolute;
z-index: -1;
}
.register-switch {
height: 32px;
margin-bottom: 20px;
padding: 4px;
position: relative;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.register-switch-input {
display: none;
}
.register-switch-label {
float: left;
width: 50%;
line-height: 32px;
color: #fff;
text-align: center;
cursor: pointer;
}
.register-switch-label:after {
position: absolute;
content: "";
width: 100%;
height: 100%;
background: lightblue;
left: 0;
top: 0;
z-index: -1;
border-radius: 5px;
}
.register-switch-input:checked + .register-switch-label:after {
background: tomato;
}
.register-switch-input:checked + .register-switch-label {
font-weight: normal;
color: #666;
background: #fff;
border-radius: 2px;
background-image: -webkit-linear-gradient(top, #fefefe, #eeeeee);
background-image: -moz-linear-gradient(top, #fefefe, #eeeeee);
background-image: -o-linear-gradient(top, #fefefe, #eeeeee);
background-image: linear-gradient(to bottom, #fefefe, #eeeeee);
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.1);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.1);
}
<form name="sign-up" class="sign-up__form">
<div class="register-switch">
<input type="radio" name="sex" value="Male" id="sex-m" class="register-switch-input" checked>
<label for="sex-m" class="register-switch-label">Male</label>
<input type="radio" name="sex" value="Female" id="sex-f" class="register-switch-input">
<label for="sex-f" class="register-switch-label">Female</label>
</div>
</form>
I have in my style.css the rule which applies to entire web site:
a:hover{text-decoration:underline;color:#E35B00;}
I have also in my button.css:
.button {
display: inline-block;
zoom: 1; /* zoom and *display = ie7 hack for display:inline-block */
*display: inline;
vertical-align: baseline;
margin: 0 2px;
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
font: 14px/100% Arial, Helvetica, sans-serif;
font-weight:bold;
padding: .5em 1.5em .55em;
text-shadow: 0 1px 1px rgba(0,0,0,.3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .5em;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.button:hover {
text-decoration: none;
}
.button:active {
position: relative;
top: 1px;
}
.green {
color: #e8f0de;
border: solid 1px #538312;
background: #64991e;
background: -webkit-gradient(linear, left top, left bottom, from(#7db72f), to(#4e7d0e));
background: -moz-linear-gradient(top, #7db72f, #4e7d0e);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#7db72f', endColorstr='#4e7d0e');
}
.green:hover {
background: #538018;
background: -webkit-gradient(linear, left top, left bottom, from(#6b9d28), to(#436b0c));
background: -moz-linear-gradient(top, #6b9d28, #436b0c);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6b9d28', endColorstr='#436b0c');
}
.green:active {
color: #a9c08c;
background: -webkit-gradient(linear, left top, left bottom, from(#4e7d0e), to(#7db72f));
background: -moz-linear-gradient(top, #4e7d0e, #7db72f);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#4e7d0e', endColorstr='#7db72f');
}
In my html page I have declared style.css before the button.css:
<link href="/css/style.css" media="screen" rel="stylesheet" type="text/css" />
<link href="/css/button.css" media="screen" rel="stylesheet" type="text/css" />
The code is:
<div>
<form action="dosomething.htm" method="post">
<input type="submit" class="button blue" value="Option 1">
Option 2
</form>
</div>
The blue button (Option 1) has no problem with hovering because it is not an anchor. However the green button (Option 2) when hover over "Option 2" it is turning to the color of a:hover which is #E35B00 orange color instead of #538018; green color!
On the Firefox developer Rules console I am seeing the a:hover is below the green:hover. Why is this the case? I tried rearranging the order of the css but it's no use. The a:hover takes over the green:hover. This is driving me nuts. Your help is appreciated. Thanks in advance.
You never specify what color you want the text to be when you hover on the .green button, so it defaults to a:hover. To fix this, you just have to add in the color of what the .green button to the CSS .green:hover rule.
The whole .green:hover CSS rule should look like this.
.green:hover {
color: #e8f0de;
background: #538018;
background: -webkit-gradient(linear, left top, left bottom, from(#6b9d28), to(#436b0c));
background: -moz-linear-gradient(top, #6b9d28, #436b0c);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6b9d28', endColorstr='#436b0c');
}
a:hover {
text-decoration: underline;
color: #E35B00;
}
.button {
display: inline-block;
zoom: 1;
/* zoom and *display = ie7 hack for display:inline-block */
*display: inline;
vertical-align: baseline;
margin: 0 2px;
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
font: 14px/100% Arial, Helvetica, sans-serif;
font-weight: bold;
padding: .5em 1.5em .55em;
text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .5em;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.button:hover {
text-decoration: none;
}
.button:active {
position: relative;
top: 1px;
}
.green {
color: #e8f0de;
border: solid 1px #538312;
background: #64991e;
background: -webkit-gradient(linear, left top, left bottom, from(#7db72f), to(#4e7d0e));
background: -moz-linear-gradient(top, #7db72f, #4e7d0e);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#7db72f', endColorstr='#4e7d0e');
}
.green:hover {
color: #e8f0de;
background: #538018;
background: -webkit-gradient(linear, left top, left bottom, from(#6b9d28), to(#436b0c));
background: -moz-linear-gradient(top, #6b9d28, #436b0c);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#6b9d28', endColorstr='#436b0c');
}
.green:active {
color: #a9c08c;
background: -webkit-gradient(linear, left top, left bottom, from(#4e7d0e), to(#7db72f));
background: -moz-linear-gradient(top, #4e7d0e, #7db72f);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#4e7d0e', endColorstr='#7db72f');
}
<div>
<form action="dosomething.htm" method="post">
<input type="submit" class="button blue" value="Option 1" />
Option 2
</form>
</div>
Another option is to put !important after color: #e8f0de in the .green CSS rule. !important makes a property take precedence no matter what.
If you want to do this, then the first line of the .green rule should be.
color: #e8f0de !important;
a:hover {
text-decoration: underline;
color: #E35B00;
}
.button {
display: inline-block;
zoom: 1;
/* zoom and *display = ie7 hack for display:inline-block */
*display: inline;
vertical-align: baseline;
margin: 0 2px;
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
font: 14px/100% Arial, Helvetica, sans-serif;
font-weight: bold;
padding: .5em 1.5em .55em;
text-shadow: 0 1px 1px rgba(0, 0, 0, .3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .5em;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.button:hover {
text-decoration: none;
}
.button:active {
position: relative;
top: 1px;
}
.green {
color: #e8f0de !important;
border: solid 1px #538312;
background: #64991e;
background: -webkit-gradient(linear, left top, left bottom, from(#7db72f), to(#4e7d0e));
background: -moz-linear-gradient(top, #7db72f, #4e7d0e);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#7db72f', endColorstr='#4e7d0e');
}
.green:hover {
background: #538018;
background: -webkit-gradient(linear, left top, left bottom, from(#6b9d28), to(#436b0c));
background: -moz-linear-gradient(top, #6b9d28, #436b0c);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#6b9d28', endColorstr='#436b0c');
}
.green:active {
color: #a9c08c;
background: -webkit-gradient(linear, left top, left bottom, from(#4e7d0e), to(#7db72f));
background: -moz-linear-gradient(top, #4e7d0e, #7db72f);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#4e7d0e', endColorstr='#7db72f');
}
<div>
<form action="dosomething.htm" method="post">
<input type="submit" class="button blue" value="Option 1" />
Option 2
</form>
</div>
I dont find how i can horizontal align my submit button.
i would like to align my submit button to the right of my input field.
i try several things but its not working.
here is my html file :
<body>
<form:form class="form" method="post" action="/it-portail/passwordChange.mvc" commandName='email'>
<h3>Formulaire email</h3>
<form:errors class ="errorPass" path="email" />
<div class="field">
<form:label path="email">Email:</form:label>
<form:input class ="input" path="email" />
<p class="hint">Entrez votre email.</p>
</div>
<input class="button" type="submit" value="VALIDER" />
</form:form>
here is my css file :
.form {
width: 600px;
display:inline-block;
padding: 20px;
background: #f0f0f0;
overflow: auto;
/* Border style */
border: 1px solid #cccccc;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
/* Border Shadow */
-moz-box-shadow: 2px 2px 2px #cccccc;
-webkit-box-shadow: 2px 2px 2px #cccccc;
box-shadow: 2px 2px 2px #cccccc;
position:absolute;
left: 30%;
top: 40%;
width: 600px;
height: 200px;
margin-left: -100px; /* Cette valeur doit être la moitié négative de la valeur du width */
margin-top: -100px; /* Cette valeur doit être la moitié négative de la valeur du height */
}
input {
font-family: Arial, Verdana;
font-size: 15px;
padding: 5px;
padding-top:5px
border: 1px solid #b9bdc1;
width: 150px;
color: #797979;
text-align:center;
}
.field {
margin-top:4px;
margin-bot:2px;
}
.button {
float: none;
margin-top:5px;
font-weight: bold;
line-height: 1;
cursor: pointer;
color: #fff;
vertical-align:40%;
text-shadow: 0 -1px 1px #64799e;
/* Background gradient */
background: #a5b8da;
background: -moz-linear-gradient(top, #a5b8da 0%, #7089b3 100%);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#a5b8da),
to(#7089b3));
/* Border style */
border: 1px solid #5c6f91;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
/* Box shadow */
-moz-box-shadow: inset 0 1px 0 0 #aec3e5;
-webkit-box-shadow: inset 0 1px 0 0 #aec3e5;
box-shadow: inset 0 1px 0 0 #aec3e5;
}
thanks,
Change float: none; to float: right;
DEMO
Add this to your .button css as
position:absolute;
right:15px;
top:145px;
for this I have updated some of your css and html.
css
input {
font-family: Arial, Verdana;
font-size: 15px;
padding: 5px;
padding-top:5px
border: 1px solid #b9bdc1;
width: 150px;
color: #797979;
text-align:center;
float:left;
margin-right:10px;
}
.field {
margin-top:4px;
margin-bot:2px;
}
.button {
float:left;
font-weight: bold;
cursor: pointer;
color: #fff;
text-shadow: 0 -1px 1px #64799e;
/* Background gradient */
background: #a5b8da;
background: -moz-linear-gradient(top, #a5b8da 0%, #7089b3 100%);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#a5b8da),
to(#7089b3));
/* Border style */
border: 1px solid #5c6f91;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
/* Box shadow */
-moz-box-shadow: inset 0 1px 0 0 #aec3e5;
-webkit-box-shadow: inset 0 1px 0 0 #aec3e5;
box-shadow: inset 0 1px 0 0 #aec3e5;
}
.label{
float:left;
margin-right:10px;
}
.hint{
clear:both
}
html
<form:form class="form" method="post" action="/it-portail/passwordChange.mvc" commandName='email'>
<h3>Formulaire email</h3>
<form:errors class ="errorPass" path="email" />
<div class="field">
<form:label path="email" class="label">Email:</form:label>
<input name="" type="text" class ="input" />
<input class="button" type="submit" value="VALIDER" />
<p class="hint">Entrez votre email.</p>
</div>
</form:form>
jsFiddle File
please check this is working for you or not.
Thank you :)
Change your .button's css...
from
float: none;
margin-top:5px;
to
float: right;
margin-top:-25px;
DEMO : http://jsfiddle.net/a4QNB/166/
I've got a container that has a contact form in it.. the form is ignoring my width of 140px and somehow computing itself out to 300px. no idea where it's coming from.
HTML:
<div id="main" role="main">
<div id="mail">
<form id="signup" action="<?=$_SERVER['PHP_SELF']; ?>" method="get">
<fieldset>
<span id="response">
<? require_once('php/store-address.php'); if($_GET['submit']){ echo storeAddress(); } ?>
</span>
<input type="email" name="email" id="email" placeholder="Enter your email address" />
<input type="submit" id="submit" class="btn" value="Go" />
</fieldset>
</form>
</div>
</div>
CSS:
#main {
width:300px;
height:110px;
padding:10px 20px 10px 20px;
position:absolute;
bottom:50px;
left:50%;
margin-left:-170px;
background-color: #f0f3f8;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#f0f3f8), to(#a9a9ad));
background: -moz-linear-gradient(100% 100% 90deg, #a9a9ad, #f0f3f8);
background: -o-linear-gradient(#f0f3f8, #a9a9ad);
border-radius: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
//text-shadow: 0 -1px 1px rgba(0,0,0,0.25);
//border-bottom: 1px solid rgba(0,0,0,0.25);
box-shadow: 0 1px 3px rgba(0,0,0,0.5);
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
////////CONTACT FORM
#mail {
width:140px;
height:95px;
float:right;
display:block;
/*background: #c9d0de; border: 1px solid #e1e1e1;
-moz-box-shadow: 0px 0px 8px #444;
-webkit-box-shadow: 0px 0px 8px #444;*/
}
#response {
width:140px;
height:25px;
margin-bottom:10px;
display:block;
font-style:italic;
}
input {
width: 124px;
height: 9px;
padding: 8px;
margin: 0 0 10px 0;
background: #5E768D;
background: -moz-linear-gradient(top, #546A7F 0%, #5E768D 20%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#546A7F), color-stop(20%,#5E768D));
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
-moz-box-shadow: 0px 1px 0px #f2f2f2;
-webkit-box-shadow: 0px 1px 0px #f2f2f2;
font-family: sans-serif;
font-size: 10px;
color: #f2f2f2;
text-shadow: 0px -1px 0px #334f71;
outline:none;
}
input::-webkit-input-placeholder {
color: #a1b2c3; text-shadow: 0px -1px 0px #38506b;
}
input:-moz-placeholder {
color: #a1b2c3; text-shadow: 0px -1px 0px #38506b;
}
input:focus, textarea:focus {
background: #728eaa;
background: -moz-linear-gradient(top, #668099 0%, #728eaa 20%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#668099), color-stop(20%,#728eaa));
}
input[type=submit] {
width: 40px;
height: 25px;
padding:5px;
margin: 0 auto;
display:block;
-moz-box-shadow: 0px 0px 5px #999;-webkit-box-shadow: 0px 0px 5px #999;
border: 1px solid #556f8c;
background: -moz-linear-gradient(top, #718DA9 0%, #415D79 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#718DA9), color-stop(100%,#415D79));
cursor: pointer;
}
JSFiddle link
You can't have comments with //. Only multi-line comments work with css. You'll have to remove this comment:
////////CONTACT FORM
The rest of your styles should work after you remove that.