Checkbox checked is not altering css - html

I've styled a checkbox like a button however when the checkbox is checked it doesn't apply the style that I have wrote for the button.
Just wondering what I am doing wrong hopefully it's not too obvious.
Html
<div class="customCheckBox"style="margin-top:10px; margin: 10px auto;">
<input class="checkbox" type="checkbox" name="check1" id="check1">
<label class="checklabel" for="check1">Directors, Managers & Professionals</label>
</div>
CSS
body {
font-family: 'Source Sans Pro', Arial, sans-serif;
font-size: 14px;
line-height: 1.429;
margin: 0;
padding: 0;
color: #000000;
}
.customCheckBox{
height: 60px;
display:flex;
width:190px;
color: #702082;
font-weight: 600;
border:3px solid #702082;
position: relative;
align-items: center;
transition: all 0.2s;
}
.customCheckBox:hover{
background-color: #702082;
color: white;
-moz-box-shadow: 3px 3px 10px rgba(0, 0, 0,0.25);
-webkit-box-shadow: 3px 3px 10px rgba(0, 0, 0, .25);
box-shadow: 3px 3px 10px rgba(0, 0, 0, .25);
}
.checklabel {
text-align:center;
font-size:1.1em;
}
.checkbox {
position:absolute;
right:-3px;
top:-3px;
width: 190px;
height: 60px;
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
appearance: none;
border:none;
padding:0;
border-radius:0;
transition:.3s ease;
outline:0;
}
.checkbox:checked + .customCheckBox {
background-color: #702082;
color: white;
}
Here Is a Jfiddle of it too http://jsfiddle.net/pjtmzLy5/1/.

Should be like this;
In css + means what is right next to the previous one.
In your case .checkbox:checked + .checklabel.
So if checkbox is :checked than style the checklabel;
You need to add default styles for .checklabel so adding height&width inherit should do the trick; than add more styles like justify-content & align-items to center it;
body {
font-family: 'Source Sans Pro', Arial, sans-serif;
font-size: 14px;
line-height: 1.429;
margin: 0;
padding: 0;
color: #000000;
}
.customCheckBox{
height: 60px;
width:190px;
color: #702082;
font-weight: 600;
border:3px solid #702082;
position: relative;
align-items: center;
transition: all 0.2s;
}
.customCheckBox:hover{
background-color: #702082;
color: white;
-moz-box-shadow: 3px 3px 10px rgba(0, 0, 0,0.25);
-webkit-box-shadow: 3px 3px 10px rgba(0, 0, 0, .25);
box-shadow: 3px 3px 10px rgba(0, 0, 0, .25);
}
.checklabel {
display:flex;
justify-content: center;
align-items: center;
text-align:center;
font-size:1.1em;
height: inherit;
width: inherit;
}
.checkbox {
position:absolute;
right:-3px;
top:-3px;
width: 190px;
height: 60px;
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
appearance: none;
border:none;
padding:0;
border-radius:0;
transition:.3s ease;
outline:0;
}
.checkbox:checked + .checklabel {
background-color: #702082;
color: white;
}
<div class="customCheckBox"style="margin-top:10px; margin: 10px auto;">
<input class="checkbox" type="checkbox" name="check1" id="check1">
<label class="checklabel" for="check1">Directors, Managers & Professionals</label>
</div>
I Would suggest you to remove all the styles from .checkbox since you are hiding it you only need
.checkbox {display: none}

Move the checkbox outside of the div tag:
<input class="checkbox" type="checkbox" name="check1" id="check1">
<div class="customCheckBox"style="margin-top:10px; margin: 10px auto;">
<label class="checklabel" for="check1">Directors, Managers & Professionals</label>
</div>
The + selector in CSS means .customCheckBox directly following .checkbox:checked.
See this answer: https://stackoverflow.com/a/1139776/1825032

Related

How to associate label with checkbox but not using "for=id"

i have this code:
<li><input type="checkbox" id="checkboxThree" value="Alergia3" ><label for="checkboxThree">Alergia 1</label></li>
<li><input type="checkbox" id="checkboxFour" value="Alergia4"><label for="checkboxFour">Alergia 1</label></li>
<li><input type="checkbox" id="checkboxFive" value="Alergia5"><label for="checkboxFive">Alergia 1</label></li>
<li><input type="checkbox" id="checkboxSix" value="Alergia6" ><label for="checkboxSix">Alergia 1</label></li>
But I don't want to use "id" and "for" because I have to do other thing later and I can't use them. I have see this question: Possible to associate label with checkbox without using "for=id"? and I have triet what the first peson says:
<li><label ><input type="checkbox" name="Alergia1">Alergia 1</label></li>
<li><label ><input type="checkbox" name="Alergia2" >Alergia 1</label></li>
But It does not work either.
This is the entire project to see that it does not work:
.font-robo {
font-family: "Roboto", "Arial", "Helvetica Neue", sans-serif;
}
.font-poppins {
font-family: "Poppins", "Arial", "Helvetica Neue", sans-serif;
}
html {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
* {
padding: 0;
margin: 0;
}
*, *:before, *:after {
-webkit-box-sizing: inherit;
-moz-box-sizing: inherit;
box-sizing: inherit;
}
/* ==========================================================================
#GRID
========================================================================== */
/* ==========================================================================
#BOX-SIZING
========================================================================== */
/**
* More sensible default box-sizing:
* css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice
*/
/* ==========================================================================
#RESET
========================================================================== */
/**
* A very simple reset that sits on top of Normalize.css.
*/
body,
h1, h2, h3, h4, h5, h6,
blockquote, p, pre,
dl, dd, ol, ul,
figure,
hr,
fieldset, legend {
margin: 0;
padding: 0;
}
/**
* Remove trailing margins from nested lists.
*/
li > ol,
li > ul {
margin-bottom: 0;
}
/**
* Remove default table spacing.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}
/**
* 1. Reset Chrome and Firefox behaviour which sets a `min-width: min-content;`
* on fieldsets.
*/
fieldset {
min-width: 0;
/* [1] */
border: 0;
}
button {
outline: none;
background: none;
border: none;
}
/* ==========================================================================
#PAGE WRAPPER
========================================================================== */
.page-wrapper {
height:100vh;
}
body {
font-family: "Poppins", "Arial", "Helvetica Neue", sans-serif;
font-weight: 400;
font-size: 14px;
}
h1, h2, h3, h4, h5, h6 {
font-weight: 400;
}
h1 {
font-size: 36px;
}
h2 {
font-size: 30px;
color: #00929a !important;
}
h3 {
font-size: 24px;
}
h4 {
font-size: 18px;
}
h5 {
font-size: 15px;
}
h6 {
font-size: 13px;
}
/* ==========================================================================
#BACKGROUND
========================================================================== */
.bg-blue {
background: #2c6ed5;
}
.bg-red {
background: #fa4251;
}
.bg-gra-01 {
background: -webkit-gradient(linear, left bottom, left top, from(#00929a), to(#034649));
background: -webkit-linear-gradient(bottom, #00929a 0%, #034649 100%);
background: -moz-linear-gradient(bottom, #00929a 0%, #034649 100%);
background: -o-linear-gradient(bottom, #00929a 0%, #034649 100%);
background: linear-gradient(to top, #00929a 0%, #034649 100%);
}
.bg-gra-02 {
background: -webkit-gradient(linear, left bottom, right top, from(#00929a), to(#034649));
background: -webkit-linear-gradient(bottom left, #00929a 0%, #034649 100%);
background: -moz-linear-gradient(bottom left, #00929a 0%, #034649 100%);
background: -o-linear-gradient(bottom left, #00929a 0%, #034649 100%);
background: linear-gradient(to top right, #00929a 0%, #034649 100%);
}
/* ==========================================================================
#CHECKBOX
========================================================================== */
.container {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
font-size: 13px;
}
ul.ks-cboxtags {
list-style: none;
margin-bottom: 20px;
}
ul.ks-cboxtags li{
display: inline;
}
ul.ks-cboxtags li label{
display: inline-block;
background-color: rgba(255, 255, 255, .9);
border: 2px solid rgba(139, 139, 139, .3);
color: #adadad;
border-radius: 25px;
white-space: nowrap;
margin: 3px 0px;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-tap-highlight-color: transparent;
transition: all .2s;
}
ul.ks-cboxtags li label {
padding: 20px 20px;
cursor: pointer;
margin:20px;
}
ul.ks-cboxtags li label::before {
display: inline-block;
font-style: normal;
font-variant: normal;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
font-family: "Font Awesome 5 Free";
font-weight: 900;
font-size: 12px;
padding: 20px;
transition: transform .3s ease-in-out;
}
ul.ks-cboxtags li input[type="checkbox"]:checked + label {
border: 2px solid #00929a;
background-color: #00929a;
color: #fff;
transition: all .2s;
}
ul.ks-cboxtags li input[type="checkbox"] {
display: absolute;
}
ul.ks-cboxtags li input[type="checkbox"] {
position: absolute;
width: 60vh;
opacity: 0;
}
ul.ks-cboxtags li input[type="checkbox"]:focus + label {
border: 2px solid #034649;
}
/* ==========================================================================
#SPACING
========================================================================== */
.p-t-100 {
padding-top: 100px;
}
.p-t-130 {
padding-top: 130px;
}
.p-t-180 {
padding-top: 180px;
}
.p-t-20 {
padding-top: 20px;
}
.p-t-15 {
padding-top: 15px;
}
.p-t-10 {
padding-top: 10px;
}
.p-t-30 {
padding-top: 30px;
}
.p-b-100 {
padding-bottom: 100px;
}
.m-r-45 {
margin-right: 45px;
}
/* ==========================================================================
#WRAPPER
========================================================================== */
.wrapper {
margin: 0 auto;
}
.wrapper--w960 {
max-width: 960px;
}
.wrapper--w780 {
max-width: 780px;
}
.wrapper--w680 {
max-width: 680px;
}
/* ==========================================================================
#BUTTON
========================================================================== */
.btn {
display: inline-block;
line-height: 50px;
padding: 0 50px;
-webkit-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
-moz-transition: all 0.4s ease;
transition: all 0.4s ease;
cursor: pointer;
font-size: 18px;
color: #fff;
font-family: "Poppins", "Arial", "Helvetica Neue", sans-serif;
}
.btn--radius {
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
.btn--radius-2 {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.btn--pill {
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
}
.btn--green {
background: #00929a;
}
.btn--green:hover {
background: #00929a;
}
.btn--blue {
background: #034649;
}
.btn--blue:hover {
background: #034649;
}
/* ==========================================================================
#DATE PICKER
========================================================================== */
td.active {
background-color: #034649;
}
input[type="date" i] {
padding: 14px;
}
.table-condensed td, .table-condensed th {
font-size: 14px;
font-family: "Roboto", "Arial", "Helvetica Neue", sans-serif;
font-weight: 400;
}
.daterangepicker td {
width: 40px;
height: 30px;
}
.daterangepicker {
border: none;
-webkit-box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.15);
box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.15);
display: none;
border: 1px solid #e0e0e0;
margin-top: 5px;
}
.daterangepicker::after, .daterangepicker::before {
display: none;
}
.daterangepicker thead tr th {
padding: 10px 0;
}
.daterangepicker .table-condensed th select {
border: 1px solid #ccc;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
font-size: 14px;
padding: 5px;
outline: none;
}
/* ==========================================================================
#FORM
========================================================================== */
input {
outline: none;
margin: 0;
border: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
width: 100%;
font-size: 14px;
font-family: inherit;
}
.input--style-4 {
line-height: 50px;
background: #fafafa;
-webkit-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
-moz-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
padding: 0 20px;
font-size: 16px;
color: #666;
-webkit-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
-moz-transition: all 0.4s ease;
transition: all 0.4s ease;
}
.input--style-4::-webkit-input-placeholder {
/* WebKit, Blink, Edge */
color: #666;
}
.input--style-4:-moz-placeholder {
/* Mozilla Firefox 4 to 18 */
color: #666;
opacity: 1;
}
.input--style-4::-moz-placeholder {
/* Mozilla Firefox 19+ */
color: #666;
opacity: 1;
}
.input--style-4:-ms-input-placeholder {
/* Internet Explorer 10-11 */
color: #666;
}
.input--style-4:-ms-input-placeholder {
/* Microsoft Edge */
color: #666;
}
.label {
font-size: 16px;
color: #555;
text-transform: capitalize;
display: block;
margin-bottom: 5px;
}
.radio-container {
display: inline-block;
position: relative;
padding-left: 30px;
cursor: pointer;
font-size: 16px;
color: #666;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.radio-container input {
position: absolute;
opacity: 0;
cursor: pointer;
}
.radio-container input:checked ~ .checkmark {
background-color: #e5e5e5;
}
.radio-container input:checked ~ .checkmark:after {
display: block;
}
.radio-container .checkmark:after {
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
width: 12px;
height: 12px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: #00929a;
}
.checkmark {
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
left: 0;
height: 20px;
width: 20px;
background-color: #e5e5e5;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
-webkit-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
-moz-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
}
.checkmark:after {
content: "";
position: absolute;
display: none;
}
.input-group {
position: relative;
margin-bottom: 22px;
}
.input-group-icon {
position: relative;
}
.input-icon {
position: absolute;
font-size: 18px;
color: #999;
right: 18px;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
cursor: pointer;
}
/* ==========================================================================
#SELECT2
========================================================================== */
.select--no-search .select2-search {
display: none !important;
}
.rs-select2 .select2-container {
width: 100% !important;
outline: none;
background: #fafafa;
-webkit-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
-moz-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, 0.08);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.rs-select2 .select2-container .select2-selection--single {
outline: none;
border: none;
height: 50px;
background: transparent;
}
.rs-select2 .select2-container .select2-selection--single .select2-selection__rendered {
line-height: 50px;
padding-left: 0;
color: #555;
font-size: 16px;
font-family: inherit;
padding-left: 22px;
padding-right: 50px;
}
.rs-select2 .select2-container .select2-selection--single .select2-selection__arrow {
height: 50px;
right: 20px;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-webkit-justify-content: center;
-moz-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-webkit-align-items: center;
-moz-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.rs-select2 .select2-container .select2-selection--single .select2-selection__arrow b {
display: none;
}
.rs-select2 .select2-container .select2-selection--single .select2-selection__arrow:after {
font-family: "Material-Design-Iconic-Font";
content: '\f2f9';
font-size: 24px;
color: #999;
-webkit-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
-moz-transition: all 0.4s ease;
transition: all 0.4s ease;
}
.rs-select2 .select2-container.select2-container--open .select2-selection--single .select2-selection__arrow::after {
-webkit-transform: rotate(-180deg);
-moz-transform: rotate(-180deg);
-ms-transform: rotate(-180deg);
-o-transform: rotate(-180deg);
transform: rotate(-180deg);
}
.select2-container--open .select2-dropdown--below {
border: none;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.15);
box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.15);
border: 1px solid #e0e0e0;
margin-top: 5px;
overflow: hidden;
}
.select2-container--default .select2-results__option {
padding-left: 22px;
}
/* ==========================================================================
#TITLE
========================================================================== */
.title {
font-size: 30px;
font-weight: 400;
margin-bottom: 20px;
}
/*========================================================================== */
.frase {
font-size: 18px;
color: #525252;
font-weight: 400;
margin-bottom: 40px;
}
/* ==========================================================================
#CARD
========================================================================== */
.card {
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
background: #fff;
}
.card-4 {
background: #fff;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-webkit-box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.15);
-moz-box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.15);
box-shadow: 0px 8px 20px 0px rgba(0, 0, 0, 0.15);
}
.card-4 .card-body {
padding: 17px 50px;
padding-bottom: 55px;
padding-top: 20px;
}
#media (max-width: 767px) {
.card-4 .card-body {
padding: 50px 40px;
}
}
<!DOCTYPE html>
<html lang="es">
<head>
<!-- Required meta tags-->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Title Page-->
<title>Alergias</title>
<!-- Icons font CSS-->
<link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css">
<!-- Font special for pages-->
<link href="https://fonts.googleapis.com/css?family=Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">
<!-- Vendor CSS-->
<!-- Main CSS-->
<link href="css/alergias.css" rel="stylesheet" media="all">
</head>
<body>
<div class="page-wrapper bg-gra-02 p-t-130 p-b-100 font-poppins">
<div class="wrapper wrapper--w680">
<div class="card card-4">
<div class="card-body">
<h2 class="title">Alergias</h2>
<h5 class="frase">Por favor, elige todas las alergias que tengas, para poder hacer los menus adaptados a ti:</h5>
<form method="POST">
<!---------------------------------------------------------------------->
<div class="container">
<ul class="ks-cboxtags">
<li><label ><input type="checkbox" name="Alergia1">Alergia 1</label></li>
<li><label ><input type="checkbox" name="Alergia2" >Alergia 1</label></li>
<li><input type="checkbox" id="checkboxThree" value="Alergia3" ><label for="checkboxThree">Alergia 1</label></li>
<li><input type="checkbox" id="checkboxFour" value="Alergia4"><label for="checkboxFour">Alergia 1</label></li>
<li><input type="checkbox" id="checkboxFive" value="Alergia5"><label for="checkboxFive">Alergia 1</label></li>
<li><input type="checkbox" id="checkboxSix" value="Alergia6" ><label for="checkboxSix">Alergia 1</label></li>
<li><input type="checkbox" id="checkboxSeven" value="Alergia7"><label for="checkboxSeven">Alergia 1</label></li>
<li><input type="checkbox" id="checkboxEight" value="Alergia8"><label for="checkboxEight">Alergia 1</label></li>
</ul>
</div>
<!---------------------------------------------------------------------->
<div class="p-t-15">
<button class="btn btn--radius-2 btn--blue" type="submit">Registrarse</button>
</div>
</form>
</div>
</div>
</div>
</div>
</body>
</html>
So the first two checkboxes doesn't work.
Is there other way to do that? Thank you!
It doesn't seem to work for the first two "checkboxes" because putting the checkboxes in the label elements makes this CSS rule stop working:
ul.ks-cboxtags li input[type="checkbox"]:checked + label
That rule only applies to a checkbox followed by a label, not a label with a checkbox inside it.
If you're going to use the pattern with the checkbox inside the label, you're going to have to find a different way to do the styling. CSS isn't my strong suit, but as I understand it it's hard to style an element based on something inside that element. (There was once, briefly, a :contains pseudo-class, but it was never broadly supported because IIRC there were issues with performance.) This question's answers describe ways to do it, but unfortunately I think you're stuck with JavaScript if you do the containment.

How to make a text or html tag look like a button

I want to show a p tag or legend tag or any html text like button. But how is it possible? I have tried with css but not working well.
I want to show it like button.
<p class="button" >Submit</p>
or
<a class="button" >Submit</a>
or
<legend class="button" >Submit</legend>
Now need the button class.
Just apply css styles and cursor: pointer; to it to make it appear that it's a button
.button{
display: inline-block;
background: #000;
border-radius: 4px;
font-family: "arial-black";
font-size: 14px;
color: #FFF;
padding: 8px 12px;
cursor: pointer;
}
JSFIDDLE
It is simple with css.
<p class='btn'> Button 1 </p>
And Your CSS
.btn{
float:left;
width:auto;
height:30px;
display:block;
border:1px solid #ff6600;
background:#00ff00;
color:#000;
line-height:30px;
text-align:center;
padding:0 20px;
border-radius:3px;
}
.btn:hover{
cursor:pointer;
}
jsfiddle : http://jsfiddle.net/ob67xnw4/1/
Try This.
Here is the Working FIDDLE
CSS
.button {
width: 75px;
background: #d2d2d2;
text-align: center;
float: left;
color: #000;
line-height: 32px;
text-decoration: none;
}
.button: hover{
width: 75px;
background: #0e567f;
color: #fff;
text-align: center;
float: left;
line-height: 32px;
text-decoration: none;
}
<p class='button'> Submit </p>
.button{
background: -webkit-linear-gradient(top, #CCB5B6 20%, #274936 70%);
width: 100px;
height: 40px;
font-family: sans-serif;
font-size: 25px;
text-align: center;
line-height: 40px;
color: #96F256;
border-radius: 10px;
box-shadow: 0 2px 5px 3px black;
cursor: pointer;
}
.button:hover{
color: white;
}
OUTPUT
I think you should use this code and it is working well. You can change Color according to you.
Live Demo
HTML Code:
<input class="round-button-circle" type="submit" value="Submit"/>
CSS Code:
.round-button-circle {
width: 150px;
height:50px;
border-radius: 10px;
border:2px solid #cfdcec;
overflow:hidden;
font-weight: 15px;
background: #4679BD;
box-shadow: 0 0 3px gold;
}
.round-button-circle:hover {
background:#30588e;
}
Result:
Had just got what did I want.
DEMO JSFIDDLE
.button {
display: inline-block;
outline: none;
cursor: pointer;
border: solid 1px #da7c0c;
background: #478dad;
text-align: center;
text-decoration: none;
font: 14px/100% Arial, Helvetica, sans-serif;
padding: .5em 2em .55em;
text-shadow: 0 1px 1px rgba(0,0,0,.3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .3em;
-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 {
background: #f47c20;
background: -webkit-gradient(linear, left top, left bottom, from(#f88e11), to(#f06015));
background: -moz-linear-gradient(top, #f88e11, #f06015);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11', endColorstr='#f06015');
}
.button:active {
position: relative;
top: 1px;
}

Having trouble with CSS3 search box

I'm using this precoded css3 search box but it isn't working for me.
The CSS:
.cf:before, .cf:after{
.cf:after{
clear:both;
}
.cf{
zoom:1;
}
/* Form wrapper styling */
.form-wrapper {
width: 450px;
padding: 15px;
margin:50px auto;
background:rgb(7,131,71);
background: rgba(0,0,0,.2);
border-radius: 10px;
box-shadow: 0 1px 1px rgba(0,0,0,.4) inset, 0 1px 0 rgba(255,255,255,.2);
}
/* Form text input */
.form-wrapper input {
width: 330px;
height: 20px;
padding: 10px 5px;
float: left;
font: bold 15px 'lucida sans', 'trebuchet MS', 'Tahoma';
border: 0;
background: #eee;
border-radius: 3px 0 0 3px;
}
.form-wrapper input:focus {
outline: 0;
background: #fff;
box-shadow: 0 0 2px rgba(0,0,0,.8) inset;
}
.form-wrapper input::-webkit-input-placeholder {
color: rgb(7,131,71);
font-weight: normal;
font-style: italic;
}
.form-wrapper input:-moz-placeholder {
color: rgb(7,131,71);
font-weight: normal;
font-style: italic;
}
.form-wrapper input:-ms-input-placeholder {
color: rgb(7,131,71);
font-weight: normal;
font-style: italic;
}
/* Form submit button */
.form-wrapper button {
overflow: visible;
position: relative;
float: right;
border: 0;
padding: 0;
cursor: pointer;
height: 40px;
width: 110px;
font: bold 15px/40px 'lucida sans', 'trebuchet MS', 'Tahoma';
color: #fff;
text-transform: uppercase;
background: rgb(7,131,71);
border-radius: 0 3px 3px 0;
text-shadow: 0 -1px 0 rgba(0, 0 ,0, .3);
}
.form-wrapper button:hover{
background: #3A423B;
}
.form-wrapper button:active,
.form-wrapper button:focus{
background: rgb(7,131,71);
outline: 0;
}
.form-wrapper button:before { /* left arrow */
content: '';
position: absolute;
border-width: 8px 8px 8px 0;
border-style: solid solid solid none;
border-color: transparent rgb(7,131,71) transparent;
top: 12px;
left: -6px;
}
.form-wrapper button:hover:before{
border-right-color: #3A423B;
}
.form-wrapper button:focus:before,
.form-wrapper button:active:before{
border-right-color: rgb(7,131,71);
}
.form-wrapper button::-moz-focus-inner { /* remove extra button spacing for Mozilla Firefox */
border: 0;
padding: 0;
}
The HTML:
<form class="form-wrapper cf">
<form method="get" action="https://encrypted.google.com/search" target="_top">
<input type="text" name="q" placeholder="Search here..." required>
<button type="submit">Charge!</button>
</form>
Everything seems to work fine except when I click "Charge!" (the submit button). Nothing happens. It doesn't search through google like it's supposed to. Help?
You have two form tags. You need to close your input tag. I don't know what required is for, but this works:
http://jsfiddle.net/t743qqxo/
<form class="form-wrapper cf" method="get" action="https://encrypted.google.com/search" target="_top">
<input type="text" name="q" placeholder="Search here..." required />
<button type="submit">Charge!</button>
</form>

Add a form inside an accordion

I am currently using the accordion I found here.
Here is the CSS:
.ac-container{
width: 400px;
margin: 10px auto 30px auto;
}
.ac-container label{
font-family: 'BebasNeueRegular', 'Arial Narrow', Arial, sans-serif;
padding: 5px 20px;
position: relative;
z-index: 20;
display: block;
height: 30px;
cursor: pointer;
color: #777;
text-shadow: 1px 1px 1px rgba(255,255,255,0.8);
line-height: 33px;
font-size: 19px;
background: linear-gradient(top, #ffffff 1%,#eaeaea 100%);
box-shadow:
0px 0px 0px 1px rgba(155,155,155,0.3),
1px 0px 0px 0px rgba(255,255,255,0.9) inset,
0px 2px 2px rgba(0,0,0,0.1);
background: none repeat scroll 0 0 #F8F7F5;
}
.ac-container label:hover{
background: #fff;
}
.ac-container input:checked + label,
.ac-container input:checked + label:hover{
background: #c6e1ec;
color: #3d7489;
text-shadow: 0px 1px 1px rgba(255,255,255, 0.6);
box-shadow:
0px 0px 0px 1px rgba(155,155,155,0.3),
0px 2px 2px rgba(0,0,0,0.1);
}
.ac-container label:hover:after,
.ac-container input:checked + label:hover:after{
content: '';
position: absolute;
width: 24px;
height: 24px;
right: 13px;
top: 7px;
background: transparent url(../images/arrow_down.png) no-repeat center center;
}
.ac-container input:checked + label:hover:after{
background-image: url(../images/arrow_up.png);
}
.ac-container input{
display: none;
}
.ac-container article{
background: rgba(255, 255, 255, 0.5);
margin-top: -1px;
overflow: hidden;
height: 0px;
position: relative;
z-index: 10;
transition:
height 0.3s ease-in-out,
box-shadow 0.6s linear;
}
.ac-container input:checked ~ article{
transition:
height 0.5s ease-in-out,
box-shadow 0.1s linear;
box-shadow: 0px 0px 0px 1px rgba(155,155,155,0.3);
}
.ac-container article p{
font-style: italic;
color: #777;
line-height: 23px;
font-size: 14px;
padding: 20px;
text-shadow: 1px 1px 1px rgba(255,255,255,0.8);
}
.ac-container input:checked ~ article.ac-small{
height: 440px;
}
.ac-container input:checked ~ article.ac-medium{
height: 180px;
}
.ac-container input:checked ~ article.ac-large{
height: 230px;
}
And here is the HTML code:
<section class="ac-container">
<div>
<input id="ac-1" name="accordion-1" type="checkbox" />
<label for="ac-1">Available options </label>
<article class="ac-small">
<form name="myform" action="http://www.mydomain.com/myformhandler.cgi" method="POST">
<div align="center"><br>
<input type="radio" name="group1" value="Milk"> Milk<br>
<input type="radio" name="group1" value="Butter" checked> Butter<br>
<input type="radio" name="group1" value="Cheese"> Cheese
</div>
</form>
</article>
</div>
<div><!--...--></div>
</section>
Unfortunatly, I can't see the radio button inside the accordion (when I drop down the "Available options") but I can see the items. Did i do something wrong ?
The problem here is that the CSS3 accordion uses the dynamic :checked pseudo-class on a checkbox input. Clicking on an "accordion header" toggles that checkbox's checked state, and that then toggles the styles on the accordion's content. To remove the checkboxes though, the accordion has the following style:
.ac-container input {
display: none;
}
This also inherits to the inputs in your form. You can solve this by just overriding that style:
.ac-container form input {
display:inline;
}

IE Tooltip displays underneath link text

Only on IE the tooltip shows underneath the text of the link therefore the text in the tooltip can't be read. I know I could move the tooltip over to the right but that doesn't look good.
How can I make the tooltip background solid or on top of the links. I already tried z-index.
<ul style=" list-style: circle; margin: 0px 2px 0px 12px;">
<li style="z-index:10">
<a class="tooltip" href="abc.com"> <span class="classic" ><%= content %></span></a>
</li>
</ul>
.classic
{
padding: 0.8em 1em;
display:none;
text-decoration: none;
list-style: circle;
background:#FFC62E;
}
.tooltip {
border-bottom: 1px dotted #000000;
color: #000000;
outline: none;
text-decoration: none;
position: relative;
}
.tooltip span
{
display:inline;
margin-left: -999em;
position: absolute;
text-decoration: none;
color:#000000;
}
.tooltip:hover span {
font-family: Calibri, Tahoma, Geneva, sans-serif;
position: absolute;
left: 1em;
top: 2em;
z-index: 1;
margin-left: 170;
width: 250px;
display:inline-block;
background-color: #FFC62E;
background:rgb(255,198,46);
position:absolute;
text-decoration: none;
color:#000000;
border-radius: 5px 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 5px 5px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 5px 5px rgba(0, 0, 0, 0.1);
}
How about this:
http://fiddle.jshell.net/br6AP/