I'm trying to style several checkbox with CSS, but only one is working. What is wrong in my code? I'd like to have unique ids for the checkboxes, but the CSS here doesn't seem to allow it.
demo: http://jsfiddle.net/JW3qf/65/
html:
<div class="slideparam">
<input type="checkbox" id="slideparam" value="1">
<label for="slideparam"></label>
</div>
<div class="slideparam">
<input type="checkbox" id="slideparam" value="1">
<label for="slideparam"></label>
</div>
css:
input[type=checkbox] {
visibility: hidden;
}
/* SLIDE THREE */
.slideparam {
width: 80px;
height: 26px;
background: #333;
margin: 20px auto;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
position: relative;
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
}
.slideparam:after {
content: 'OFF';
font: 12px/26px Arial, sans-serif;
color: #000;
position: absolute;
right: 10px;
z-index: 0;
font-weight: bold;
text-shadow: 1px 1px 0px rgba(255,255,255,.15);
}
.slideparam:before {
content: 'ON';
font: 12px/26px Arial, sans-serif;
color: #00bf00;
position: absolute;
left: 10px;
z-index: 0;
font-weight: bold;
}
.slideparam label {
display: block;
width: 34px;
height: 20px;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
-webkit-transition: all .4s ease;
-moz-transition: all .4s ease;
-o-transition: all .4s ease;
-ms-transition: all .4s ease;
transition: all .4s ease;
cursor: pointer;
position: absolute;
top: 3px;
left: 3px;
z-index: 1;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
background: #fcfff4;
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );
}
.slideparam input[type=checkbox]:checked + label {
left: 43px;
}
IDs must be unique, meaning that you can only use a particular ID once on a page. Classes, on the other hand, can be used multiple times on a page.
You'll want to use IDs so that your labels work correctly, but make each ID different to keep it unique. I suggest a structure like this:
input[type=checkbox] {
visibility: hidden;
}
.slideparam {
position: relative;
width: 80px;
height: 26px;
background: #333;
margin: 20px auto;
border-radius: 50px;
box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px rgba(255, 255, 255, 0.2);
}
.slideparam:after {
content: 'OFF';
position: absolute;
right: 10px;
z-index: 0;
font: 12px/26px Arial, sans-serif;
color: #000;
font-weight: bold;
text-shadow: 1px 1px 0px rgba(255, 255, 255, .15);
}
.slideparam:before {
content: 'ON';
position: absolute;
left: 10px;
z-index: 0;
font: 12px/26px Arial, sans-serif;
color: #00bf00;
font-weight: bold;
}
.slideparam label {
display: block;
position: absolute;
top: 3px;
left: 3px;
width: 34px;
height: 20px;
border-radius: 50px;
transition: all .4s ease;
cursor: pointer;
z-index: 1;
box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.3);
background: #fcfff4;
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fcfff4', endColorstr='#b3bead', GradientType=0);
}
.slideparam input[type=checkbox]:checked+label {
left: 43px;
}
<div class="slideparam">
<input type="checkbox" id="slideparam_1" value="1" />
<label for="slideparam_1"></label>
</div>
<div class="slideparam">
<input type="checkbox" id="slideparam_2" value="2" />
<label for="slideparam_2"></label>
</div>
<div class="slideparam">
<input type="checkbox" id="slideparam_3" value="3" />
<label for="slideparam_3"></label>
</div>
<input type="checkbox" id="slideparam" value="1">
<input type="checkbox" id="slideparam" value="1">
id has to be UNIQUE
I suggest you to validate your html with w3c validator. You'd have noticed the error.
Just replace your ID's with unique values and apply your styling in another way.
The problem is that your css is styling classes, but you don't have any classes in your css, rather you have ids instad of classes.
Change the ids in your html to classes and it will work.
.slideparam
stands for class
while in your html there is only id="slideparam"
Related
In search of: CSS only, or comprehensible, small jquery. I've already written out exactly what I want in CSS only, using ":focus" and "tabindex="1"".
Objective:
- Click on div = div expands. (note: heavy CSS changing of multiple elements)
- Expanded div has child buttons inside.
- Child buttons clickable.
This worked like a charm with ":focus" and "tabindex="1"", but clicking on an the link inside the div removes the focus, and reverses the div expansion. I thought this workaround worked. But nay.
Here is a JSfiddle of what I've created (This is for an archives page on a webcomics site.) I have left all the styling, so you may understand exactly what I'm intending:
https://jsfiddle.net/gvs291wf/1/
.comicselector {
width: 200px;
height: 200px;
transition: .3s;
margin: 0 auto 45px;
display: flex;
}
.comicselector:hover {
box-shadow: -5px 0px 20px 10px hsla(0, 0%, 0%, .4), 5px 0px 20px 10px hsla(0, 0%, 0%, .4);
}
.comicselector:focus {
width: 400px;
height: 500px;
outline-width: 0;
box-shadow: -30vw 0 0px 0px hsla(280, 0%, 10%, 0.5), 30vw 0 0px 0 hsla(280, 0%, 10%, 0.5);
z-index: 101;
cursor: default;
}
.comimg {
flex: 1;
display: flex;
flex-direction: column;
background: #840;
}
.comimgtitle {
font-family: 'Days One', sans-serif;
font-size: 3em;
font-weight: 800;
text-shadow: 0px 2px 15px hsla(0, 0%, 0%, 1);
margin: auto;
transition: 0.3s;
}
.comicselector:focus .comimgtitle {
opacity: 0;
font-size: 0;
}
.comimgauthor {
font-size: 2em;
font-weight: 800;
text-shadow: 0px 2px 15px hsla(0, 0%, 0%, 1);
font-variant: small-caps;
margin: auto;
transition: 0.3s;
}
.comicselector:focus .comimgauthor {
opacity: 0;
font-size: 0;
}
.cominfo {
flex: 0;
background: hsla(190, 50%, 45%, 1);
display: flex;
flex-direction: column;
align-items: center;
overflow: hidden;
transition: .4s;
}
.comicselector:focus .cominfo {
flex: 1;
}
.infochild {
font-size: 0;
transition: 0s;
}
.comicselector:focus .infochild {
margin: auto;
z-index: 110;
transition: .5s;
}
.comictitle {
padding: 20px 0;
}
.comicselector:focus .comictitle {
font-size: 3em;
text-shadow: 0px 4px 20px hsla(0, 0%, 35%, .4);
}
.comicselector:focus .comicauthor {
font-weight: 700;
font-size: 2em;
letter-spacing: 0.2em;
text-indent: 0.2em;
pointer-events: none;
}
.comicselector:focus .startbeg {
width: 42%;
min-height: 70px;
background: hsla(0, 0%, 35%, 0.4);
color: #fff;
font-size: 1em;
letter-spacing: 0.2em;
text-indent: 0.2em;
text-decoration: none;
margin: 15% auto 0;
display: flex;
justify-content: center;
align-items: center;
}
.comicselector:focus .startbeg:hover {
text-shadow: 0px 2px 12px hsla(0, 0%, 90%, 0.6);
box-shadow: -230px 0 0px 0px hsla(280, 0%, 10%, 0.1), 230px 0 0px 0 hsla(280, 0%, 10%, 0.1), 0px 0px 24px 6px hsla(0, 0%, 20%, 0.1);
background: hsla(0, 60%, 50%, 1);
}
.comicselector:focus .startlatest {
width: 42%;
min-height: 50px;
background: hsla(260, 0%, 35%, 0.4);
color: #fff;
font-size: 1em;
text-decoration: none;
margin: 1% auto 8%;
display: flex;
justify-content: center;
align-items: center;
}
.comicselector:focus .startlatest:hover {
text-shadow: 0px 2px 12px hsla(0, 0%, 90%, 0.6);
box-shadow: -230px 0 0px 0px hsla(280, 0%, 10%, 0.1), 230px 0 0px 0 hsla(280, 0%, 10%, 0.1), 0px 0px 24px 6px hsla(0, 0%, 20%, 0.1);
background: hsla(260, 60%, 50%, 1);
}
.seriesinfo {
font-size: 0;
opacity: 0;
}
.comicselector:focus .seriesinfo {
opacity: 1;
width: 100%;
box-sizing: border-box;
min-height: 100px;
padding: 30px 10%;
font-size: 1.2em;
line-height: 1.2em;
text-align: center;
background: hsla(260, 0%, 0%, 0.1);
}
.comicselector:focus .eachseriesnav {
width: 100%;
box-sizing: border-box;
padding: 15px 10%;
font-size: 1.2em;
background: hsla(260, 0%, 0%, 0.1);
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.comicselector:focus .chapnavlinks {
color: #fff;
text-decoration: none;
padding: 10px 16px;
margin: 2px;
background: hsla(260, 0%, 0%, 0.1);
flex-grow: 1;
transition: 0s;
}
.comicselector:focus .chapnavlinks:hover {
text-shadow: 0px 2px 12px hsla(0, 0%, 90%, 0.6);
box-shadow: 0px 0px 15px 2px hsla(0, 0%, 20%, 0.6);
background: hsla(260, 50%, 45%, 1);
transition: .5s;
}
<div class="comicselector" tabindex="1">
<div class="comimg">
<div class="comimgtitle">Title</div>
<div class="comimgauthor">Author</div>
</div>
<div class="cominfo">
<div class="comictitle infochild">title2</div>
<div class="comicauthor infochild">author2</div>
Start
Latest Release
<div class="seriesinfo infochild">comicdescrip
</div>
<div class="eachseriesnav infochild">
Chapter 1,2,etc
</div>
</div>
</div>
Thank you!
I think that this should do what you intended. For each .comicselector there is a <label> that controls a hidden radio button. When the radio button is :checked the respective .comicselector has the behavior you want for the :focus. Since all radio buttons belong to the same group via the name attribute, checking one unchecks the current selected one.
When a radio is checked we hide the corresponding label (display: none), to prevent the .comicselector from closing by clicking it.
I've also added a background label to enable closing the selected .comicselector from outside.
watch the snippet in the full page mode
.bg__label {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.comicselector {
position: relative;
width: 200px;
height: 200px;
transition: .3s;
margin: 0 auto 45px;
display: flex;
}
.comicselector:hover {
box-shadow: -5px 0px 20px 10px hsla(0, 0%, 0%, .4), 5px 0px 20px 10px hsla(0, 0%, 0%, .4);
}
.comicselector__overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.check {
position: absolute;
z-index: -1;
visibility: hidden;
}
.check:checked+.comicselector>.comicselector__overlay {
display: none;
}
.check:checked+.comicselector {
width: 400px;
height: 500px;
outline-width: 0;
box-shadow: -30vw 0 0px 0px hsla(280, 0%, 10%, 0.5), 30vw 0 0px 0 hsla(280, 0%, 10%, 0.5);
z-index: 101;
cursor: default;
}
.comimg {
flex: 1;
display: flex;
flex-direction: column;
background: #840;
}
.comimgtitle {
font-family: 'Days One', sans-serif;
font-size: 3em;
font-weight: 800;
text-shadow: 0px 2px 15px hsla(0, 0%, 0%, 1);
margin: auto;
transition: 0.3s;
}
.check:checked+.comicselector .comimgtitle {
opacity: 0;
font-size: 0;
}
.comimgauthor {
font-size: 2em;
font-weight: 800;
text-shadow: 0px 2px 15px hsla(0, 0%, 0%, 1);
font-variant: small-caps;
margin: auto;
transition: 0.3s;
}
.check:checked+.comicselector .comimgauthor {
opacity: 0;
font-size: 0;
}
.cominfo {
flex: 0;
background: hsla(190, 50%, 45%, 1);
display: flex;
flex-direction: column;
align-items: center;
overflow: hidden;
transition: .4s;
}
.check:checked+.comicselector .cominfo {
flex: 1;
}
.infochild {
font-size: 0;
transition: 0s;
}
.check:checked+.comicselector .infochild {
margin: auto;
z-index: 110;
transition: .5s;
}
.comictitle {
padding: 20px 0;
}
.check:checked+.comicselector .comictitle {
font-size: 3em;
text-shadow: 0px 4px 20px hsla(0, 0%, 35%, .4);
}
.check:checked+.comicselector .comicauthor {
font-weight: 700;
font-size: 2em;
letter-spacing: 0.2em;
text-indent: 0.2em;
pointer-events: none;
}
.check:checked+.comicselector .startbeg {
width: 42%;
min-height: 70px;
background: hsla(0, 0%, 35%, 0.4);
color: #fff;
font-size: 1em;
letter-spacing: 0.2em;
text-indent: 0.2em;
text-decoration: none;
margin: 15% auto 0;
display: flex;
justify-content: center;
align-items: center;
}
.check:checked+.comicselector .startbeg:hover {
text-shadow: 0px 2px 12px hsla(0, 0%, 90%, 0.6);
box-shadow: -230px 0 0px 0px hsla(280, 0%, 10%, 0.1), 230px 0 0px 0 hsla(280, 0%, 10%, 0.1), 0px 0px 24px 6px hsla(0, 0%, 20%, 0.1);
background: hsla(0, 60%, 50%, 1);
}
.check:checked+.comicselector .startlatest {
width: 42%;
min-height: 50px;
background: hsla(260, 0%, 35%, 0.4);
color: #fff;
font-size: 1em;
text-decoration: none;
margin: 1% auto 8%;
display: flex;
justify-content: center;
align-items: center;
}
.check:checked+.comicselector .startlatest:hover {
text-shadow: 0px 2px 12px hsla(0, 0%, 90%, 0.6);
box-shadow: -230px 0 0px 0px hsla(280, 0%, 10%, 0.1), 230px 0 0px 0 hsla(280, 0%, 10%, 0.1), 0px 0px 24px 6px hsla(0, 0%, 20%, 0.1);
background: hsla(260, 60%, 50%, 1);
}
.seriesinfo {
font-size: 0;
opacity: 0;
}
.check:checked+.comicselector .seriesinfo {
opacity: 1;
width: 100%;
box-sizing: border-box;
min-height: 100px;
padding: 30px 10%;
font-size: 1.2em;
line-height: 1.2em;
text-align: center;
background: hsla(260, 0%, 0%, 0.1);
}
.check:checked+.comicselector .eachseriesnav {
width: 100%;
box-sizing: border-box;
padding: 15px 10%;
font-size: 1.2em;
background: hsla(260, 0%, 0%, 0.1);
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.check:checked+.comicselector .chapnavlinks {
color: #fff;
text-decoration: none;
padding: 10px 16px;
margin: 2px;
background: hsla(260, 0%, 0%, 0.1);
flex-grow: 1;
transition: 0s;
}
.check:checked+.comicselector .chapnavlinks:hover {
text-shadow: 0px 2px 12px hsla(0, 0%, 90%, 0.6);
box-shadow: 0px 0px 15px 2px hsla(0, 0%, 20%, 0.6);
background: hsla(260, 50%, 45%, 1);
transition: .5s;
}
<input id="check0" type="radio" name="control" class="check" />
<label for="check0" class="bg__label"></label>
<input id="check1" type="radio" name="control" class="check" />
<div class="comicselector" tabindex="1">
<label for="check1" class="comicselector__overlay"></label>
<div class="comimg">
<div class="comimgtitle">Title</div>
<div class="comimgauthor">Author</div>
</div>
<div class="cominfo">
<div class="comictitle infochild">title2</div>
<div class="comicauthor infochild">author2</div>
Start
Latest Release
<div class="seriesinfo infochild">comicdescrip
</div>
<div class="eachseriesnav infochild">
Chapter 1,2,etc
</div>
</div>
</div>
<input id="check2" type="radio" name="control" class="check" />
<div class="comicselector" tabindex="1">
<label for="check2" class="comicselector__overlay"></label>
<div class="comimg">
<div class="comimgtitle">Title</div>
<div class="comimgauthor">Author</div>
</div>
<div class="cominfo">
<div class="comictitle infochild">title2</div>
<div class="comicauthor infochild">author2</div>
Start
Latest Release
<div class="seriesinfo infochild">comicdescrip
</div>
<div class="eachseriesnav infochild">
Chapter 1,2,etc
</div>
</div>
</div>
Can someone help me on how to have a fixed width for all buttons using css. Please find the jsFiddle link for the same. I have tried my best but unable to get a clue. Thanks in advance.
HTML:
<div id="container">
<div class="button-row width">
Menu Organizer
</div>
<div class="button-row">
Place Order
</div>
<div class="button-row-submenu width">
Category
</div>
<div class="button-row-submenu">
Building
</div>
<div class="button-row">
User Preference
</div>
<div class="button-row">
Ok
</div>
</div>
CSS:
/* some styles */
div#container {
width: 800px;
margin: 50px auto;
}
div.button-row {
margin: 20px 0;
text-align: left;
}
/* button */
.button {
font-family: Helvetica, Arial, sans-serif;
font-size: 15px;
font-weight: bold;
width: 200px;
color: #FFFFFF;
padding: 6px 50px;
margin: 0 20px;
text-shadow: 2px 2px 1px #595959;
filter: dropshadow(color=#595959, offx=1, offy=1);
text-decoration: none;
}
/* button shapes */
.rounded {
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
}
/* button colors */
.red {
border: solid 1px #720000;
background-color: #c72a2a;
background: -moz-linear-gradient(top, #c72a2a 0%, #9e0e0e 100%);
background: -webkit-linear-gradient(top, #c72a2a 0%, #9e0e0e 100%);
background: -o-linear-gradient(top, #c72a2a 0%, #9e0e0e 100%);
background: -ms-linear-gradient(top, #c72a2a 0% ,#9e0e0e 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9e0e0e', endColorstr='#9e0e0e',GradientType=0 );
background: linear-gradient(top, #c72a2a 0% ,#9e0e0e 100%);
-webkit-box-shadow: 0px 0px 1px #FF3300, inset 0px 0px 1px #FFFFFF;
-moz-box-shadow: 0px 0px 1px #FF3300, inset 0px 0px 1px #FFFFFF;
box-shadow: 0px 0px 1px #FF3300, inset 0px 0px 1px #FFFFFF;
}
.red:hover {
background-color: #b52f2f;
background: -moz-linear-gradient(top, #b52f2f 0%, #910b0b 100%);
background: -webkit-linear-gradient(top, #b52f2f 0%, #910b0b 100%);
background: -o-linear-gradient(top, #b52f2f 0%, #910b0b 100%);
background: -ms-linear-gradient(top, #b52f2f 0% ,#910b0b 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#910b0b', endColorstr='#910b0b',GradientType=0 );
background: linear-gradient(top, #b52f2f 0% ,#910b0b 100%);
}
.red:active {
background-color: #8f2222;
background: -moz-linear-gradient(top, #8f2222 0%, #660808 100%);
background: -webkit-linear-gradient(top, #8f2222 0%, #660808 100%);
background: -o-linear-gradient(top, #8f2222 0%, #660808 100%);
background: -ms-linear-gradient(top, #8f2222 0% ,#660808 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#660808', endColorstr='#660808',GradientType=0 );
background: linear-gradient(top, #8f2222 0% ,#660808 100%);
}
/* button effects */
.effect-3 {
transition: border-radius 1s;
-webkit-transition: border-radius 1s;
-moz-transition: border-radius 1s;
-o-transition: border-radius 1s;
-ms-transition: border-radius 1s;
}
.effect-3:hover {
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
}
.width{
width: 550px;
}
Can someone help me on how to have a fixed width for all buttons using css.
You can't set widths on inline elements. Solution: give them display:inline-block. Inline-blocks have widths.
/* some styles */
body {
background: url(../images/bg1.jpg) repeat;
}
div#container {
width: 800px;
margin: 50px auto;
}
div.button-row {
margin: 20px 0;
text-align: left;
}
div.button-row-submenu {
margin: 15px 50px;
text-align: left;
}
/* button */
.button {
display: inline-block;
font-family: Helvetica, Arial, sans-serif;
font-size: 15px;
font-weight: bold;
width: 200px;
color: #FFFFFF;
padding: 6px 50px;
margin: 0 20px;
text-shadow: 2px 2px 1px #595959;
filter: dropshadow(color=#595959, offx=1, offy=1);
text-decoration: none;
}
.subbutton {
font-family: Helvetica, Arial, sans-serif;
font-size: 13px;
font-weight: bold;
color: #FFFFFF;
padding: 5px 30px;
margin: 0 20px;
text-shadow: 2px 2px 1px #595959;
filter: dropshadow(color=#595959, offx=1, offy=1);
text-decoration: none;
}
/* button shapes */
.rounded {
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
}
.shape-3 {
-webkit-border-radius: 40px 40px 5px 5px;
border-radius: 40px 40px 5px 5px;
-moz-border-radius-topleft: 40px;
-moz-border-radius-topright: 40px;
-moz-border-radius-bottomleft: 5px;
-moz-border-radius-bottomright: 5px;
}
.shape-4 {
-webkit-border-radius: 5px 5px 40px 40px;
border-radius: 5px 5px 40px 40px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
-moz-border-radius-bottomleft: 40px;
-moz-border-radius-bottomright: 40px;
}
/* button colors */
.red {
border: solid 1px #720000;
background-color: #c72a2a;
background: -moz-linear-gradient(top, #c72a2a 0%, #9e0e0e 100%);
background: -webkit-linear-gradient(top, #c72a2a 0%, #9e0e0e 100%);
background: -o-linear-gradient(top, #c72a2a 0%, #9e0e0e 100%);
background: -ms-linear-gradient(top, #c72a2a 0%, #9e0e0e 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#9e0e0e', endColorstr='#9e0e0e', GradientType=0);
background: linear-gradient(top, #c72a2a 0%, #9e0e0e 100%);
-webkit-box-shadow: 0px 0px 1px #FF3300, inset 0px 0px 1px #FFFFFF;
-moz-box-shadow: 0px 0px 1px #FF3300, inset 0px 0px 1px #FFFFFF;
box-shadow: 0px 0px 1px #FF3300, inset 0px 0px 1px #FFFFFF;
}
.red:hover {
background-color: #b52f2f;
background: -moz-linear-gradient(top, #b52f2f 0%, #910b0b 100%);
background: -webkit-linear-gradient(top, #b52f2f 0%, #910b0b 100%);
background: -o-linear-gradient(top, #b52f2f 0%, #910b0b 100%);
background: -ms-linear-gradient(top, #b52f2f 0%, #910b0b 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#910b0b', endColorstr='#910b0b', GradientType=0);
background: linear-gradient(top, #b52f2f 0%, #910b0b 100%);
}
.red:active {
background-color: #8f2222;
background: -moz-linear-gradient(top, #8f2222 0%, #660808 100%);
background: -webkit-linear-gradient(top, #8f2222 0%, #660808 100%);
background: -o-linear-gradient(top, #8f2222 0%, #660808 100%);
background: -ms-linear-gradient(top, #8f2222 0%, #660808 100%);
filter: progid: DXImageTransform.Microsoft.gradient(startColorstr='#660808', endColorstr='#660808', GradientType=0);
background: linear-gradient(top, #8f2222 0%, #660808 100%);
}
/* button effects */
.effect-3 {
transition: border-radius 1s;
-webkit-transition: border-radius 1s;
-moz-transition: border-radius 1s;
-o-transition: border-radius 1s;
-ms-transition: border-radius 1s;
}
.effect-3:hover {
border-radius: 5px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
}
.width {
width: 550px;
}
<div id="container">
<div class="button-row width">
Menu Organizer
</div>
<div class="button-row">
Place Order
</div>
<div class="button-row-submenu width">
Category
</div>
<div class="button-row-submenu">
Building
</div>
<div class="button-row">
User Preference
</div>
<div class="button-row">
Ok
</div>
</div>
Ho to all,
I got this problem :
<input type ="file" name ="fileUpload">
I Made a file input that by default dispalys "choose a file".
I don't really like it so i want to make it like a Button the problem Is that when i try to surround it with Button tag or span with a Button property
I would like to know if i can hide the "choose a file" Making the file input tag like a single Button
Thanks for your future answers
Have a nice day
Luca
<style>
.fileUpload {
position: relative;
overflow: hidden;
margin: 10px;
}
.upload {
position: absolute;
top: 0;
left: 0;
margin: 0;
padding: 0;
font-size: 20px;
cursor: pointer;
opacity: 0;
filter: alpha(opacity=0);
}
</style>
<div class="fileUpload">
<span>Upload</span>
<input type="file" class="upload" />
</div>
Just wrap it around a span and give color:white to span. For example like this http://jsfiddle.net/25bju0a4/
<style type="text/css">
.button {
width: 124px;
height: 27px;
}
.button::-webkit-file-upload-button {
visibility: hidden;
}
.button:before {
content: 'Select some files';
display: inline-block;
background: -webkit-linear-gradient(top, #F9F9F9, #E3E3E3);
background: -moz-linear-gradient(top, #F9F9F9, #E3E3E3);
background: -ms-linear-gradient(top, #F9F9F9, #E3E3E3);
background: -o-linear-gradient(top, #F9F9F9, #E3E3E3);
background: linear-gradient(top, #F9F9F9, #E3E3E3);
border: 1px solid #999;
border-radius: 3px;
padding: 5px 8px;
outline: none;
white-space: nowrap;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
cursor: pointer;
text-shadow: 1px 1px #fff;
font-weight: 700;
font-size: 10pt;
}
.button:hover:before {
border-color: black;
}
.button:active:before {
background: -webkit-gradient(linear, 0% 40%, 0% 70%, from(#E3E3E3), to(#F9F9F9));
background: -webkit-linear-gradient(top, #E3E3E3, #F9F9F9);
background: -moz-linear-gradient(top, #E3E3E3, #F9F9F9);
background: -ms-linear-gradient(top, #E3E3E3, #F9F9F9);
background: -o-linear-gradient(top, #E3E3E3, #F9F9F9);
background: linear-gradient(top, #E3E3E3, #F9F9F9);
}
</style>
<input type ="file" name ="fileUpload" class=button>
I am trying to come up with a tab control and included in here is the link to jsfiddle and what I am trying to accomplish. The issue I have in here is to eliminate the curve at the end of the unordered list after Alpha. I tried it in a lot of different ways. It looks like the next tab has been cut off.
http://jsfiddle.net/v7u3xsxk/
CSS & The Tab.
<ul class="tabrow">
<li id="a" class="current">Adam</li>
<li id="b">Andrew</li>
<li id="c">Alpha</li>
</ul>
.tabrow {
list-style: none;
margin: 50px 0 0px;
padding: 0;
line-height: 35px;
height: 37px;
overflow: hidden;
font-family: Arial,Helvetica, sans-serif;
/*position: relative;*/
width:auto;
}
.tabrow li {
border: 1px solid #AAA;
background: #D1D1D1;
background: -o-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -ms-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -moz-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -webkit-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
display: inline-block;
position: relative;
z-index: 0;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 #FFF;
text-shadow: 0 1px #FFF;
margin: 0 -5px;
padding: 0 30px;
height: 37px;
line-height: 37px;
}
.tabrow a {
color: #555;
text-decoration: none;
}
.tabrow li.current {
background: #FFF;
color: #333;
z-index: 2;
border-top-color: #FFF;
}
.tabrow:before {
position: absolute;
content: " ";
width: 100%;
top: 0;
left: 0;
border-top: 1px solid #AAA;
z-index: 1;
}
.tabrow li:before,
.tabrow li:after {
border: 1px solid #AAA;
position: absolute;
top: -1px;
width: 6px;
height: 6px;
content: " ";
}
.tabrow li:before {
left: -7px;
border-top-right-radius: 6px;
border-width: 1px 1px 0px 0px;
box-shadow: 2px 0px 0 #ECECEC;
}
.tabrow li:after {
right: -7px;
border-top-left-radius: 6px;
border-width: 1px 0px 0px 1px;
box-shadow: -2px 0px 0 #ECECEC;
}
.tabrow li.current:before {
box-shadow: 2px 0px 0 #FFF;
}
.tabrow li.current:after {
box-shadow: -2px 0px 0 #FFF;
}
Not sure why you've used the before and after elements. Seems to work if these are removed. http://jsfiddle.net/v7u3xsxk/5/
.tabrow {
list-style: none;
margin: 50px 0 0px;
padding: 0;
line-height: 35px;
height: 37px;
overflow: hidden;
font-family: Arial,Helvetica, sans-serif;
/*position: relative;*/
width:auto;
}
.tabrow li {
border: 1px solid #AAA;
background: #D1D1D1;
background: -o-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -ms-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -moz-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -webkit-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
display: inline-block;
border-radius: 5px 5px 0 0;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 #FFF;
text-shadow: 0 1px #FFF;
margin: 0 -5px;
padding: 0 30px;
height: 37px;
line-height: 37px;
}
.tabrow a {
color: #555;
text-decoration: none;
}
.tabrow li.current {
background: #FFF;
color: #333;
z-index: 2;
border-top-color: #FFF;
}
.tabrow li.current {
box-shadow: 2px 0px 0 #FFF;
}
.tabrow li.current {
box-shadow: -2px 0px 0 #FFF;
}
If you remove position: relative; from your .tabrow li class it will solve the problem.
Updated code:
.tabrow li {
border: 1px solid #AAA;
background: #D1D1D1;
background: -o-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -ms-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -moz-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: -webkit-linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
background: linear-gradient(top, #ECECEC 50%, #D1D1D1 100%);
display: inline-block;
//removed line here
z-index: 0;
border-bottom-left-radius: 6px;
border-bottom-right-radius: 6px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), inset 0 1px 0 #FFF;
text-shadow: 0 1px #FFF;
margin: 0 -5px;
padding: 0 30px;
height: 37px;
line-height: 37px;
}
Update: This method affects the styling on the rest of the menu.
I have a form label as follows:
<label id="jform_email-lbl" for="jform_email" class="hasTip required"
title="Email Address::Please enter the email address associated with your User
account.<br />A verification code will be sent to you. Once you have
received the verification code, you will be able to choose a new password for
your account.">Email Address:<span class="star"> *</span></label>
I want to apply a different style to my popover 'title' element (#000).
Not the 'Email Address:' label that shows on the form (which is #fff).
Thought I may be able to do the following, but it doesn't work:
label#jform_email-lbl[type="title"] {
color: #000;
}
****EDITED**
The answer is as follows - for anyone else trying to find the right css:**
div.tip .tip-title {
color: #E77600 !important;
font-weight: bold;
}
div.tip .tip-text {
color: #979797 !important;
font-weight: bold;
}
Later edit, i understood the question :
<!DOCTYPE html>
<html>
<head>
<style>
label {
color: #900;
text-decoration: none;
}
label:hover {
color: red;
position: relative;
}
label[title]:hover:after {
content: attr(title);
padding: 4px 8px;
color: red;
position: absolute;
left: 0;
top: 100%;
white-space: nowrap;
z-index: 20px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
-moz-box-shadow: 0px 0px 4px #222;
-webkit-box-shadow: 0px 0px 4px #222;
box-shadow: 0px 0px 4px #222;
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #eeeeee),color-stop(1, #cccccc));
background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
}
</style>
</head>
<label id="jform_email-lbl" for="jform_email" class="hasTip required" title="something">Email Address:<span class="star"> *</span></label>
</html>