css how to center this content - html

I have made a fiddle for my problem.
This is it
http://jsfiddle.net/8Kx8c/
This is the result of my code:
I need to do two things:
First, center all the content inside the div with the border. I mean this div <div id="agentsLegend">
Second, center the text to be in the center of the circle. the text exist in this code:
<span class="oneLegend">
<div class="breakLegend oneAgentLegent"></div>
Break
</span>
I tried:
text-align:center;
vertical-align:middle;
but the content is not centered.

you need to set vertical-align to .oneAgentLegent as well.
And eventually set a line-height to #agentsLegend.
DEMO
#agentsLegend {
border: 1px solid black;
border-radius:10px;
display:inline-block;
margin-top:5px;
height:38px;
line-height:30px;/* tune baseline height here */
padding-left:5px;
padding-right:5px;
}
.oneLegend {
display:inline-block;
text-align:center;
vertical-align:middle;
}
.oneAgentLegent {
border-radius:50%;
width:20px;
height: 20px;
display:inline-block;
vertical-align:middle;/* make this to vertical-align:middle to text aside */
}
To center your inline-boxe: use text-align:center on parent.
DEMO 2
body {
text-align:center;/* parent of your box in fiddle demo */
}
edit , if you want to use display:table instead, add display:table-cell to span , so it easily vertical center content : http://jsfiddle.net/8Kx8c/9/

I've done a few changes to the css. These should help you fix your issue.
Reduced the height and added padding top to #agentsLegend element.
height:28px; padding-top:9px;
Changed vertical-align:middle; to vertical-align:top; in .oneLegend element.
Added line-height: 20px; to .oneLeged element.
FIDDLE

You can accomplish this by using a combination of vertical-align on the children with line-height set on the parent for the vertical aligning, and setting display:table; and margin:0 auto on the parent to center horizontally.
Demo Fiddle
CSS
#agentsLegend {
border: 1px solid black;
border-radius:10px;
display:inline-block;
margin-top:5px;
line-height:38px;/* <-- vertical alignment */
padding-left:5px;
padding-right:5px;
display:table; /* <-- horizontal alignment */
margin:0 auto; /* <-- horizontal alignment */
}
.oneLegend {
display:inline-block;
text-align:center;
vertical-align:middle;/* <-- vertical alignment */
}
.oneAgentLegent {
border-radius:50%;
width:20px;
height: 20px;
vertical-align:-10%;/* <-- vertical alignment */
display:inline-block;
}
.agent-table-wrap td.breakAgentClass, .breakLegend {
background: #6b4e30;
/* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;
base64, PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzZiNGUzMCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM5OTg5NzIiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #6b4e30 0%, #998972 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #6b4e30), color-stop(100%, #998972));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #6b4e30 0%, #998972 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #6b4e30 0%, #998972 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #6b4e30 0%, #998972 100%);
/* IE10+ */
background: linear-gradient(to bottom, #6b4e30 0%, #998972 100%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6b4e30', endColorstr='#998972', GradientType=0);
/* IE6-8 */
color: #fff;
}
.agent-table-wrap td.idelAgentClass, .idelLegent {
background: #fcda19;
/* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;
base64, PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZjZGExOSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #fcda19 0%, #ffffff 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fcda19), color-stop(100%, #ffffff));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #fcda19 0%, #ffffff 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #fcda19 0%, #ffffff 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #fcda19 0%, #ffffff 100%);
/* IE10+ */
background: linear-gradient(to bottom, #fcda19 0%, #ffffff 100%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fcda19', endColorstr='#ffffff', GradientType=0);
/* IE6-8 */
color: #333;
}
.agent-table-wrap td.pauseAgentClass, .pauseLegend {
background: #1283b7;
/* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;
base64, PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzEyODNiNyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNiYWQxZTIiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #1283b7 0%, #bad1e2 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #1283b7), color-stop(100%, #bad1e2));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #1283b7 0%, #bad1e2 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #1283b7 0%, #bad1e2 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #1283b7 0%, #bad1e2 100%);
/* IE10+ */
background: linear-gradient(to bottom, #1283b7 0%, #bad1e2 100%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#1283b7', endColorstr='#bad1e2', GradientType=0);
/* IE6-8 */
color: #fff;
}
.agent-table-wrap td.talkingAgentClass, .talkingLegend {
background: #4ea51c;
/* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;
base64, PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzRlYTUxYyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNhYWU1NzkiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #4ea51c 0%, #aae579 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #4ea51c), color-stop(100%, #aae579));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #4ea51c 0%, #aae579 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #4ea51c 0%, #aae579 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #4ea51c 0%, #aae579 100%);
/* IE10+ */
background: linear-gradient(to bottom, #4ea51c 0%, #aae579 100%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#4ea51c', endColorstr='#aae579', GradientType=0);
/* IE6-8 */
color: #fff;
}
.agent-table-wrap td.voicemailAgentClass, .voiceMailLegend {
background: #8a38aa;
/* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;
base64, PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSI0JSIgc3RvcC1jb2xvcj0iIzhhMzhhYSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNkYjk1ZjQiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-linear-gradient(top, #8a38aa 4%, #db95f4 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(4%, #8a38aa), color-stop(100%, #db95f4));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #8a38aa 4%, #db95f4 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #8a38aa 4%, #db95f4 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #8a38aa 4%, #db95f4 100%);
/* IE10+ */
background: linear-gradient(to bottom, #8a38aa 4%, #db95f4 100%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#8a38aa', endColorstr='#db95f4', GradientType=0);
/* IE6-8 */
color: #fff;
}

You can change some properties like :
#agentsLegend {
display: table;
}
.oneLegend {
display:table-cell;
}
http://jsfiddle.net/8Kx8c/1

You need to add only line-height:38px; on #agentsLegend and vertical-align:middle; on class oneLegend
#agentsLegend {
border: 1px solid black;
border-radius:10px;
display:inline-block;
margin-top:5px;
height:38px;
line-height:38px; /*Addded line*/
padding-left:5px;
padding-right:5px;
}
.oneLegend {
display:inline-block;
text-align:center;
vertical-align:middle; /*Addded line*/
}
Here is the Fiddle link.

http://jsfiddle.net/DUgKb/19/
You cannot have a span wrapping a div. It was not working since a span is not a block element.
Add a wrapping div to center everything.
.center {
text-align: center;
}
vertical align the icons
#agentsLegend {
display: inline-block;
padding: 5px;
}
.oneAgentLegent, .oneLegend {
display: inline-block;
vertical-align: middle;
}

Related

Background color to fill top 70px of div behind text

Is there an easier way of doing this. I just want the background color to fill the top width of the div, 70px high and the entire width of the div, in this case 400px. I was able to hack out a solution but it looks ugly. Sorry I'm using inline styles since I cannot easily add new CSS to a 6,500 page website.
<div style="border: 1px solid #bbb; padding:20px; width:400px; height:150px; float:left; margin-right:60px;">
<div style="background:#cccccc; width:440px; height:40px; padding:0; position:relative; margin-left:-20px; margin-top:-20px;"></div>
<div style="background:#cccccc; width:420px; height:30px; padding-left:20px; position:relative; margin-left:-20px; margin-top:-20px;">
<p><b>To learn more:</b></p>
</div>
<p>Contact a sales rep</p>
</div>
JS Fiddle
You can use linear-gradient.
background: #eeeeee; /* Old browsers */
background: -moz-linear-gradient(top, #eeeeee 0%, #eeeeee 70px, #ffffff 70px, #ffffff 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(70px,#eeeeee), color-stop(70px,#ffffff), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #eeeeee 0%,#eeeeee 70px,#ffffff 70px,#ffffff 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #eeeeee 0%,#eeeeee 70px,#ffffff 70px,#ffffff 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #eeeeee 0%,#eeeeee 70px,#ffffff 70px,#ffffff 100%); /* IE10+ */
background: linear-gradient(to bottom, #eeeeee 0%,#eeeeee 70px,#ffffff 70px,#ffffff 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */
Codes generated by http://www.colorzilla.com/gradient-editor/

Gradient over img tag using css

I want to place a gradient over an <img> tag. src attribute of the tag is angular-item. For example:
<img src={{value.angitem.image}}>
I've tried to make css class:
.pickgradient {
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,0.65)));
}
and
<img src={{value.angitem.image}} class="pickgradient ">
but it doesn't work. What should I do?
With z-index :
You may use a container and put the gradient on that container. Then use a negative z-index to position image behind the gradient.
.pickgradient {
display:inline-block;
background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.65) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.65)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=0 ); /* IE6-9 */
}
img{
position:relative;
z-index:-1;
display:block;
height:200px; width:auto;
}
<div class="pickgradient">
<img src="http://i.imgur.com/HDssntn.jpg" />
</div>
With a pseudo element :
As commented, you can also use a pseudo element with the gradient and absolute positioning to put the gradient over the image :
.pickgradient{
position:relative;
display:inline-block;
}
.pickgradient:after {
content:'';
position:absolute;
left:0; top:0;
width:100%; height:100%;
display:inline-block;
background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.65) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.65)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=0 ); /* IE6-9 */
}
img{
display:block;
height:200px;width:auto;
}
<div class="pickgradient">
<img src="http://i.imgur.com/HDssntn.jpg" />
</div>
For 2020, mask-image can work well. It works in modern browsers (not IE, -webkit- prefix in many browsers currently). https://caniuse.com/#feat=css-masks
img {
height: 200px;
width: auto;
mask-image: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%);
-webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%);
}
<img src="http://i.imgur.com/HDssntn.jpg" />
I recommend you to set background-color:black; to your container and then set class img{opacity:0.4}. Then you will get the same effect as you got with
backgroundImage:linear-gradient(rgba(0, 0, 0, 0.8),rgba(0, 0, 0, 0.8),rgba(0, 0, 0, 0.8),rgba(0, 0, 0, 0.8)),url(img_url))
My example on Slide:
.Slide {
position: relative;
border: 1px solid blue;
min-width: 100%;
height: 100%;
transition: 0.5s;
background-color: rgb(0, 0, 0);
}
.Slide img{
position: relative;
border: 1px solid blue;
min-width: 100%;
height: 100%;
transition: 0.5s;
opacity: 0.4;
}
try placing a div over the image in question and placing the gradient on the div instead of the image.

Pressing a button sets another to be shown as active

I have a button that has 2 different colors. I don't know about a way to color a button with 2 colors and I want to avoid from putting an image to be the background so I guess that I need 2 buttons (one under the other).
Both of the colors have to be changed when pressed (active).
Does anybody knows a way to make another button to be shown as active when the first one is pressed?
playground
<button>BUTTON</button>
button{
padding:10px 25px;
color:#fff;
border:0;
background: #1e5799; /* Old browsers */
background: -moz-linear-gradient(top, #1e5799 0%, #207cca 48%, #7db9e8 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(48%,#207cca), color-stop(100%,#7db9e8)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #1e5799 0%,#207cca 48%,#7db9e8 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #1e5799 0%,#207cca 48%,#7db9e8 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #1e5799 0%,#207cca 48%,#7db9e8 100%); /* IE10+ */
background: linear-gradient(to bottom, #1e5799 0%,#207cca 48%,#7db9e8 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#7db9e8',GradientType=0 ); /* IE6-9 */
}
button:active{
background: #b4ddb4; /* Old browsers */
background: -moz-linear-gradient(top, #b4ddb4 0%, #70aa7d 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b4ddb4), color-stop(100%,#70aa7d)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #b4ddb4 0%,#70aa7d 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #b4ddb4 0%,#70aa7d 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #b4ddb4 0%,#70aa7d 100%); /* IE10+ */
background: linear-gradient(to bottom, #b4ddb4 0%,#70aa7d 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b4ddb4', endColorstr='#70aa7d',GradientType=0 ); /* IE6-9 */
}
Use the :active psudeo class:
input
{
color:red;
}
input:active
{
color:blue;
}
Fiddle here

CSS background-image gradient and border-line on bigger element

I'd like to have a background-image with a line on the end.
The border or line should begin where the background-size ends.
The border line is grey in the concept. It should stay just one element.
background-image: gradient-y(#color-grey-2, #color-white);
background-position: left top;
background-size: 100% 40px;
background-repeat: no-repeat;
http://jsfiddle.net/8Q79p/ OLD JSFIDDLE. (Wrapper)
http://jsfiddle.net/8Q79p/1/ Updated; if you want just one element, you can use color-stop
<div id="gradient">
</div>
#gradient{
background: rgb(221,221,221); /* Old browsers */
background: -moz-linear-gradient(top, rgba(221,221,221,1) 1%, rgba(255,255,255,1) 46%, rgba(149,149,149,1) 47%, rgba(149,149,149,1) 48%, rgba(255,255,255,1) 49%, rgba(252,252,252,1) 100%, rgba(27,27,27,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(1%,rgba(221,221,221,1)), color-stop(46%,rgba(255,255,255,1)), color-stop(47%,rgba(149,149,149,1)), color-stop(48%,rgba(149,149,149,1)), color-stop(49%,rgba(255,255,255,1)), color-stop(100%,rgba(252,252,252,1)), color-stop(100%,rgba(27,27,27,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(221,221,221,1) 1%,rgba(255,255,255,1) 46%,rgba(149,149,149,1) 47%,rgba(149,149,149,1) 48%,rgba(255,255,255,1) 49%,rgba(252,252,252,1) 100%,rgba(27,27,27,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(221,221,221,1) 1%,rgba(255,255,255,1) 46%,rgba(149,149,149,1) 47%,rgba(149,149,149,1) 48%,rgba(255,255,255,1) 49%,rgba(252,252,252,1) 100%,rgba(27,27,27,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(221,221,221,1) 1%,rgba(255,255,255,1) 46%,rgba(149,149,149,1) 47%,rgba(149,149,149,1) 48%,rgba(255,255,255,1) 49%,rgba(252,252,252,1) 100%,rgba(27,27,27,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(221,221,221,1) 1%,rgba(255,255,255,1) 46%,rgba(149,149,149,1) 47%,rgba(149,149,149,1) 48%,rgba(255,255,255,1) 49%,rgba(252,252,252,1) 100%,rgba(27,27,27,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dddddd', endColorstr='#1b1b1b',GradientType=0 ); /* IE6-9 */
width: 100%;
height: 100px;
border: solid 1px black;
}

Defining two id's to one piece of css code

I was wondering if there was any way of defining two section id's to a piece of css code.
At the moment the code is exactly the same apart from the id, is there any way to have both id's in one piece of the code rather than duplicating the same code. e.g
slider#nav ul
#slider ul {
list-style-type:none;
height:80px;
width:620px;
background: rgb(206,220,231); /* Old browsers */
background: -moz-linear-gradient(top, rgba(206,220,231,1) 0%, rgba(89,106,114,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(206,220,231,1)), color-stop(100%,rgba(89,106,114,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cedce7', endColorstr='#596a72',GradientType=0 ); /* IE6-9 */
-webkit-box-shadow: inset 1px 1px 3px 1px ;
box-shadow: inset 1px 1px 3px 1px ;
opacity:0.8;
}
#nav ul {
list-style-type:none;
height:80px;
width:620px;
background: rgb(206,220,231); /* Old browsers */
background: -moz-linear-gradient(top, rgba(206,220,231,1) 0%, rgba(89,106,114,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(206,220,231,1)), color-stop(100%,rgba(89,106,114,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cedce7', endColorstr='#596a72',GradientType=0 ); /* IE6-9 */
-webkit-box-shadow: inset 1px 1px 3px 1px ;
box-shadow: inset 1px 1px 3px 1px ;
opacity:0.8;
}
Simply by adding a comma.
#nav ul, #slider ul {
//Code
}
You code will now be applied to both id's