I have been given the task to recreate the following menu:
I am just not sure how to create the gradient. Done
Why cannot I see it in my code? http://jsfiddle.net/Vtr6d/
Currently I have:
CSS:
.mainOptions{
float:left;
margin:0 20px 0 20px;
color:#fff;
width:500px;
height:50px;
background:gray;
}
.mainOptions .composer{
width:50px;
height:40px;
background:-webkit-gradient(linear, 0 0, 0 100%, from(#184C82), to(#022243));
}
.mainOptions .composerIcon{
display:inline-block;
width:14px;
height:14px;
background:url('../images/composer.png') no-repeat -96px -72px;
}
.mainOptions ul li{
display:inline-block;
padding:4px 10px 4px;
border-radius:4px;
}
.mainOptions li a{
text-decoration:none;
font-size:13px;
line-height:18px;
text-align:center;
vertical-align:middle;
}
.mainOptions li{
width:140px;
background-color:pink;
}
HTML:
<nav class="mainOptions">
<ul>
<li class="composerIcon composer">Composer</li>
<li>Address Books</li>
<li class="active">Scheduled Messages</li>
<li>Templates</li>
</ul>
</nav>
Try this working in all browser.
background: #184c82; /* Old browsers */
background: -moz-linear-gradient(top, #184c82 0%, #022243 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#184c82), color-stop(100%,#022243)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #184c82 0%,#022243 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #184c82 0%,#022243 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #184c82 0%,#022243 100%); /* IE10+ */
background: linear-gradient(top, #184c82 0%,#022243 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#184c82', endColorstr='#022243',GradientType=0 ); /* IE6-9 */
background-image: -webkit-linear-gradient(linear,0%,0%,0%,100%,from(#3388FF),to(#296DCC));
background-image: -webkit-linear-gradient(top,#3388FF,#296DCC);
background-image: -ms-linear-gradient(top,#3388FF,#296DCC);
background-image: -o-linear-gradient(top,#3388FF,#296DCC);
background-image: -moz-linear-gradient(top,#3388FF,#296DCC);
background-image: linear-gradient(top,#3388FF,#296DCC);
for browser compatibility issues use all of them
Use a gradient generator? http://gradients.glrzad.com/
You can also do it manually:
background-image: linear-gradient(bottom, <color1> 5%, <color2> 53%, <color3> 77%);
background-image: -o-linear-gradient(bottom, <color1> 5%, <color2> 53%, <color3> 77%);
background-image: -moz-linear-gradient(bottom, <color1> 5%, <color2> 53%, <color3> 77%);
background-image: -webkit-linear-gradient(bottom, <color1> 5%, <color2> 53%, <color3> 77%);
background-image: -ms-linear-gradient(bottom, <color1> 5%, <color2> 53%, <color3> 77%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.05, <color1>),
color-stop(0.53, <color2>),
color-stop(0.77, <color3>)
);
With <color1>, <color2> and <color3> three rgb(x,y,z) colors. You can also edit the percentages to suit your needs.
Related
I have these two buttons:
And i want to achive this effect:
Or just make the "button 2" half transparent (fade out effect) on the left side.
I think this can be achived with a second gradient that is transparent.
EDIT: The "button 1" and the "button 2" are parts of a form.
Here is my CSS:
.myButton {
border: none;
margin-right:0;
padding-right:0;
-moz-box-shadow: 0px 10px 14px -7px #273b73;
-webkit-box-shadow: 0px 10px 14px -7px #273b73;
box-shadow: 0px 10px 14px -7px #273b73;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #595cb3), color-stop(1, #494099));
background:-moz-linear-gradient(top, #595cb3 5%, #494099 100%);
background:-webkit-linear-gradient(top, #595cb3 5%, #494099 100%);
background:-o-linear-gradient(top, #595cb3 5%, #494099 100%);
background:-ms-linear-gradient(top, #595cb3 5%, #494099 100%);
background: linear-gradient(to bottom, #595cb3 5%, #494099 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#595cb3', endColorstr='#494099',GradientType=0);
background-color:#595cb3;
-moz-border-bottom-left-radius:8px;
-webkit-border-bottom-left-radius:8px;
border-bottom-left-radius:8px; -moz-border-top-left-radius:8px;
-webkit-border-top-left-radius:8px;
border-top-left-radius:8px;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:arial;
font-size:12px;
font-weight:bold;
padding:15px 60px;
text-decoration:none;
text-shadow:0px 1px 0px #3e5b8a;
}
.myButton:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #494099), color-stop(1, #595cb3));
background:-moz-linear-gradient(top, #494099 5%, #595cb3 100%);
background:-webkit-linear-gradient(top, #494099 5%, #595cb3 100%);
background:-o-linear-gradient(top, #494099 5%, #595cb3 100%);
background:-ms-linear-gradient(top, #494099 5%, #595cb3 100%);
background:linear-gradient(to bottom, #494099 5%, #595cb3 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#494099', endColorstr='#595cb3',GradientType=0);
background-color:#494099;
}
.myButton2 {
border: none;
margin-left:-20px; padding-left:0; -moz-box-shadow: 0px 10px 14px -7px #273b73;
-webkit-box-shadow: 0px 10px 14px -7px #273b73;
box-shadow: 0px 10px 14px -7px #273b73;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #5986b3), color-stop(1, #406799));
background:-moz-linear-gradient(top, #5986b3 5%, #406799 100%);
background:-webkit-linear-gradient(top, #5986b3 5%, #406799 100%);
background:-o-linear-gradient(top, #5986b3 5%, #406799 100%);
background:-ms-linear-gradient(top, #5986b3 5%, #406799 100%);
background:linear-gradient(to bottom, #5986b3 5%, #406799 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5986b3', endColorstr='#406799',GradientType=0);
background-color:#5986b3;
-moz-border-bottom-right-radius:8px;
-webkit-border-bottom-right-radius:8px;
border-bottom-right-radius:8px; -moz-border-top-right-radius:8px;
-webkit-border-top-right-radius:8px;
border-top-right-radius:8px;
display:inline-block;
cursor:pointer;
color:#ffffff;
font-family:arial;
font-size:12px;
font-weight:bold;
padding:15px 20px;
text-decoration:none;
text-shadow:0px 1px 0px #3e5b8a;
}
.myButton2:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #406799), color-stop(1, #5986b3));
background:-moz-linear-gradient(top, #406799 5%, #5986b3 100%);
background:-webkit-linear-gradient(top, #406799 5%, #5986b3 100%);
background:-o-linear-gradient(top, #406799 5%, #5986b3 100%);
background:-ms-linear-gradient(top, #406799 5%, #5986b3 100%);
background:linear-gradient(to bottom, #406799 5%, #5986b3 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#406799', endColorstr='#5986b3',GradientType=0);
background-color:#406799;
}
If you want to use CSS gradients you could achieve that by using something like this:
button {
height: 50px;
width: 105px;
display: block;
color: #fff;
float: left;
border: none;
}
.one{
background-color: #4E4EA8;
}
.two{
background: #2f36ef; /* Old browsers */
background: -moz-linear-gradient(left, #2f36ef 0%, #2f36ef 0%, #4e4ea8 0%, #4e4ea8 5%, #557cb7 9%, #557cb7 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#2f36ef), color-stop(0%,#2f36ef), color-stop(0%,#4e4ea8), color-stop(5%,#4e4ea8), color-stop(9%,#557cb7), color-stop(100%,#557cb7)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #2f36ef 0%,#2f36ef 0%,#4e4ea8 0%,#4e4ea8 5%,#557cb7 9%,#557cb7 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, #2f36ef 0%,#2f36ef 0%,#4e4ea8 0%,#4e4ea8 5%,#557cb7 9%,#557cb7 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #2f36ef 0%,#2f36ef 0%,#4e4ea8 0%,#4e4ea8 5%,#557cb7 9%,#557cb7 100%); /* IE10+ */
background: linear-gradient(to right, #2f36ef 0%,#2f36ef 0%,#4e4ea8 0%,#4e4ea8 5%,#557cb7 9%,#557cb7 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2f36ef', endColorstr='#557cb7',GradientType=1 ); /* IE6-9 */
}
This is the example I just created:
http://jsfiddle.net/ncrd9y66/1/
I simply used http://www.colorzilla.com/gradient-editor/ to pick out colours from your example image to use in the generator and copied these into the example. Have a play with the values yourself to get the desired effect. here is mine for reference: http://www.colorzilla.com/gradient-editor/#2f36ef+0,2f36ef+0,4e4ea8+0,4e4ea8+5,557cb7+9,557cb7+100;Custom
(NOTE: these are not exactly the same colours you might be using i picked them out using PS quickly as an example of how you could achieve this effect.)
you can use the filter blur.. Try it and put the pixels size appropriate for your button.
Example:
.myButton2 {
-webkit-filter: blur(5px);
-moz-filter: blur(5px);
-ms-filter: blur(5px);
-o-filter: blur(5px);
filter: blur(5px);
}
I want to make a vertical line looking like this:
http://i41.tinypic.com/2na44n7.png
I've tried the following code:
div.vertical-line{
float:right;
width:5px;
background-color:black;
margin-right:20px;
background: #FFFFFF;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFFFF), to(#CFCFCF));
background: -webkit-linear-gradient(#FFFFFF, #CFCFCF);
background: -moz-linear-gradient(#FFFFFF, #CFCFCF);
background: -ms-linear-gradient(#FFFFFF, #CFCFCF);
background: -o-linear-gradient(#FFFFFF, #CFCFCF);
background: linear-gradient(#FFFFFF, #CFCFCF);
-pie-background: linear-gradient(#FFFFFF, #CFCFCF);
behavior: url(/pie/PIE.htc);
}
but the result wasn't as expected.
here is the result:
http://jsfiddle.net/rLyyc/
it's close, but it doesn't "fade-out" at the end of the line.
Any suggestions?
thanks in advance!
Using this generator, I got this for you:
background: #ffffff; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #c6cbd2 50%, #ffffff 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(50%,#c6cbd2), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#c6cbd2 50%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#c6cbd2 50%,#ffffff 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#c6cbd2 50%,#ffffff 100%); /* IE10+ */
background: linear-gradient(to bottom, #ffffff 0%,#c6cbd2 50%,#ffffff 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */
You'll want to add another stop point, i.e.
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFFFF), to(#CFCFCF), to(#FFFFFF));
Resulting in:
div.vertical-line{
float:right;
width:5px;
background-color:black;
margin-right:20px;
min-height: 550px;
height:100%;
background: #FFFFFF;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#FFFFFF), to(#CFCFCF), to(#FFFFFF));
background: -webkit-linear-gradient(#FFFFFF, #CFCFCF, #FFFFFF);
background: -moz-linear-gradient(#FFFFFF, #CFCFCF, #FFFFFF);
background: -ms-linear-gradient(#FFFFFF, #CFCFCF, #FFFFFF);
background: -o-linear-gradient(#FFFFFF, #CFCFCF, #FFFFFF);
background: linear-gradient(#FFFFFF, #CFCFCF, #FFFFFF);
-pie-background: linear-gradient(#FFFFFF, #CFCFCF, #FFFFFF);
behavior: url(/pie/PIE.htc);
}
It's worth looking at MDN to see how color-stops work in linear-gradient: https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient
This will create the line that your looking for and position it in the middle of the page. Just adjust the width for line-thickness, height for height of the line from top to bottom, top for how far down before the line starts, and colors to whatever you want them to be.
body:after {
content:"";
position: absolute;
z-index: 1;
top:50%;
bottom:0;
left:50%;
border: 0;
height: 80%;
width:1px;
background: #333;
background-image:
-webkit-linear-gradient(top, #ccc, #333, #ccc);
background-image: -moz-linear-gradient(top, #ccc, #333, #ccc);
background-image: -ms-linear-gradient(top, #ccc, #333, #ccc);
background-image: -o-linear-gradient(top, #ccc, #333, #ccc);
}
Below code works fine in ie 9 and doesn't work in any other browser. When I mouse hover on list background should change the color, but it doesn't.
.menunews ul {
margin: 0px;
padding: 0px;
list-style-type: none;
}
.menunews a {
display: block;
color: #266CAE;
height: 30px;
background: #ffffff;
border-bottom: 1px solid #ccc;
overflow: hidden;
width: 100%;
height: 2.72em;
line-height: 2.75em;
text-indent: 2.02em;
text-decoration: none;
}
.menunews li a:hover {
background: #ffffff;
background: -moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), color- stop(47%, #f6f6f6), color-stop(100%, #ededed));
background: -webkit-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
background: -o-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
background: -ms-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
background: linear-gradient(to bottom, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed', GradientType=0);
color: #266CAE
}
<ul style="font-size:12px;">
<li class="menunews">
<span style="margin-left:2px;">Hello test</span>
</li>
</ul>
hey actually you made the CSS in some other way that's why browsers doesn't understand your css code so i made some changes in your css and its working fine on all browsers as per your requirement so i hope this will help you.....
ul li.menunews {
border-bottom: 1px solid #ccc;
list-style:none;
height:30px;
}
ul li.menunews a {
display:block;
color:#266CAE;
text-decoration:none;
}
ul li.menunews:hover {
background:#ffffff;
background:-moz-linear-gradient(top, #ffffff 0%, #f6f6f6 47%, #ededed 100%);
background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color- stop(47%,#f6f6f6), color-stop(100%,#ededed));
background:-webkit-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%);
background:-o-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%);
background:-ms-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%);
background:linear-gradient(to bottom, #ffffff 0%,#f6f6f6 47%,#ededed 100%);
filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 );color:#266CAE}
}
<ul style="font-size:12px;">
<li class="menunews"><span style="margin-left:2px;">Hello test</span></li>
</ul>
Define your class in ul instead of li so as to take effect :
<ul class="menunews" style="font-size:12px;"><li ><a href="#" >
you have mentioned menunews class to li, the css should have been li.menunews ,use the below css code
ul{
margin:0px;
padding:0px;
list-style-type:none;
}
.menunews a{
display:block;
color:#266CAE;
height:30px;
background:#ffffff;
border-bottom: 1px solid #ccc;
overflow:hidden;
width:100%;
height:2.72em;
line-height:2.75em;
text-indent:2.02em;
text- decoration:none;
}
li.menunews a:hover{
background:#ffffff;
background:-moz-linear-gradient(top,#ffffff 0%,#f6f6f6 47%, #ededed 100%);
background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color- stop(47%,#f6f6f6), color-stop(100%,#ededed));
background:-webkit-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%);
background:-o-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%);
background:-ms-linear-gradient(top, #ffffff 0%,#f6f6f6 47%,#ededed 100%);
background:linear-gradient(to bottom, #ffffff 0%,#f6f6f6 47%,#ededed 100%);
filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ededed',GradientType=0 );
color:#266CAE;
}
Please see this DEMO
I would like to use pure css3 effects without using jQuery and I would like to make the tab expand smoothly using css3 transition, but there is a problem.
If you look at the jsfiddle file you will notice a problem with the overlapping and crashing of tabs .
This is my HTML code:
<div id="wrapper">
<nav id="mainnav">
<ol>
<li class="home"></li>
<li class="news">News</li>
<li class="photos">Photos </li>
<li class="biography">Biography</li>
</ol>
</nav>
</div>
and the CSS code:
div#wrapper{
width:990px;
height:auto;
margin:0 auto;
font:15px Arial,Verdana,Helvetica,sans-serif;
}
div#wrapper #mainnav{
width:100%;
height:40px;
border-bottom:1px solid #c4c4c4;
float:left;
clear:both;
background-color: #5b5b5b;
background-image: -moz-linear-gradient(#5b5b5b,#4d4d4d,#3f3f3f);
background-image: -webkit-linear-gradient(#5b5b5b,#4d4d4d,#3f3f3f);
background-image: -o-linear-gradient(#5b5b5b,#4d4d4d,#3f3f3f);
background-image: -ms-linear-gradient(#5b5b5b,#4d4d4d,#3f3f3f);
background-image: linear-gradient(#5b5b5b,#4d4d4d,#3f3f3f);
}
div#wrapper #mainnav ol{
list-style:none;
margin:0px; padding:0;
}
div#wrapper #mainnav li{
float:left;
}
div#wrapper #mainnav li.home{
background: #6db3f2; /* Old browsers */
background: -moz-linear-gradient(top, #6db3f2 0%, #54a3ee 40%, #3690f0 56%, #1e69de 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6db3f2), color-stop(40%,#54a3ee), color-stop(56%,#3690f0), color-stop(100%,#1e69de)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #6db3f2 0%,#54a3ee 40%,#3690f0 56%,#1e69de 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #6db3f2 0%,#54a3ee 40%,#3690f0 56%,#1e69de 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #6db3f2 0%,#54a3ee 40%,#3690f0 56%,#1e69de 100%); /* IE10+ */
background: linear-gradient(to bottom, #6db3f2 0%,#54a3ee 40%,#3690f0 56%,#1e69de 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6db3f2', endColorstr='#1e69de',GradientType=0 ); /* IE6-9 */
float:left;
width:48px;
height:40px;
position:relative;
margin-top:0px ; padding:0;
}
div#wrapper #mainnav li.home a{
background:url(home.png) 0px 0px no-repeat;
margin-left:0px;
}
div#wrapper #mainnav li.home:hover{
background: #6db3f2; /* Old browsers */
background: -moz-linear-gradient(top, #6db3f2 0%, #54a3ee 40%, #3690f0 56%, #1e69de 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6db3f2), color-stop(40%,#54a3ee), color-stop(56%,#3690f0), color-stop(100%,#1e69de)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #6db3f2 0%,#54a3ee 40%,#3690f0 56%,#1e69de 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #6db3f2 0%,#54a3ee 40%,#3690f0 56%,#1e69de 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #6db3f2 0%,#54a3ee 40%,#3690f0 56%,#1e69de 100%); /* IE10+ */
background: linear-gradient(to bottom, #6db3f2 0%,#54a3ee 40%,#3690f0 56%,#1e69de 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6db3f2', endColorstr='#1e69de',GradientType=0 ); /* IE6-9 */
float:left;
width:48px;
height:40px;
position:relative;
margin-top:0px ; padding:0;
}
div#wrapper #mainnav li.home a:hover{
background:url(home.png) 0px 0px no-repeat;
margin-left:0px;
}
div#wrapper #mainnav li.news:hover{
cursor:pointer;
border:1px solid #b30808; background-color: #e40a0a;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#e40a0a), color-stop(100%, #9f0202));
background-image: -webkit-linear-gradient(top, #e40a0a, #9f0202);
background-image: -moz-linear-gradient(top, #e40a0a, #9f0202);
background-image: -ms-linear-gradient(top, #e40a0a, #9f0202);
background-image: -o-linear-gradient(top, #e40a0a, #9f0202);
background-image: linear-gradient(top, #e40a0a, #9f0202);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#e40a0a, endColorstr=#9f0202);
}
div#wrapper #mainnav li.news a:hover{
background:url(awatch_icon.png) 5px 6px no-repeat;
padding-top:9px;
text-shadow:1px 1px 1px blue;border-left:1px solid #000;
}
div#wrapper #mainnav li.photos:hover{
background: #6db3f2; /* Old browsers */
background: -moz-linear-gradient(top, #6db3f2 0%, #54a3ee 40%, #3690f0 56%, #1e69de 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6db3f2), color- stop(40%,#54a3ee), color-stop(56%,#3690f0), color-stop(100%,#1e69de)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #6db3f2 0%,#54a3ee 40%,#3690f0 56%,#1e69de 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #6db3f2 0%,#54a3ee 40%,#3690f0 56%,#1e69de 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #6db3f2 0%,#54a3ee 40%,#3690f0 56%,#1e69de 100%); /* IE10+ */
background: linear-gradient(to bottom, #6db3f2 0%,#54a3ee 40%,#3690f0 56%,#1e69de 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6db3f2', endColorstr='#1e69de',GradientType=0 ); /* IE6-9 */
}
div#wrapper #mainnav li.photos a:hover{
background:url(domain_icon.png) 5px 6px no-repeat;padding-top:10px;text-shadow:1px 1px 1px blue;}
div#wrapper #mainnav li.biography:hover{
background-color: #ffaf46;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffaf46), color-stop(100%, #e78404));
background-image: -webkit-linear-gradient(top, #ffaf46, #e78404);
background-image: -moz-linear-gradient(top, #ffaf46, #e78404);
background-image: -ms-linear-gradient(top, #ffaf46, #e78404);
background-image: -o-linear-gradient(top, #ffaf46, #e78404);
background-image: linear-gradient(top, #ffaf46, #e78404);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#ffaf46, endColorstr=#e78404);
}
div#wrapper #mainnav li.biography a:hover{
background:url(icon.png) 5px 6px no-repeat;padding-top:10px;text-shadow:1px 1px 1px blue;}
div#wrapper #mainnav li{background:url(mainnav_sep.jpg) no-repeat left top;float:left;}
div#wrapper #mainnav li a{display:block;padding-top:11px;color:#fff;margin:0 10px;cursor:pointer;height:27px;text-shadow:1px 1px 1px #000;}
div#wrapper #mainnav li a:link, div#wrapper #mainnav li a:visited{text-decoration:none;}
div#wrapper #mainnav li a:hover,div#wrapper #mainnav li a:active, div#wrapper #mainnav li a:focus {
transition:width 2s;
-moz-transition:width 2s; /* Firefox 4 */
-webkit-transition:width 2s; /* Safari and Chrome */
-o-transition:width 2s; /* Opera */
width:120px;height:29px;margin:0px 0px 0px 0px ;text-indent:35px;text- decoration:none;color:#fff;text-shadow:1px 1px 1px #000;}
It is because you are giving transition effect to <a> element, try giving it to <li> element and change the widths...
Simply try something like this
HTML
<ul>
<li>blah</li>
<li>blah2</li>
</ul>
CSS
ul li:nth-child(1){
background-color: #ff0000;
}
ul li:nth-child(2){
background-color: #00ff00;
}
li {
display: inline-block;
height: 20px;
width: 100px;
text-align: center;
transition:width 2s;
-moz-transition:width 2s; /* Firefox 4 */
-webkit-transition:width 2s; /* Safari and Chrome */
-o-transition:width 2s; /* Opera */
}
li:hover {
width: 300px;
}
I'm trying to add an arrow image to my link and have it positioned to the middle.
My link has a background gradient in place as well and im trying to apply a background-image on to of this applied to the right.
CSS
#nav a.linkchildflyout:link,
#nav a.linkchildflyout:active,
#nav a.linkchildflyout:visited
{
display:block;
padding:0px 5px;
text-decoration:none;
background: #b95d73; /* Old browsers */
background: -moz-linear-gradient(top, #b95d73 0%, #970e2e 0%, #9c1a38 0%, #910022 52%, #b95d73 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#b95d73), color-stop(0%,#970e2e), color-stop(0%,#9c1a38), color-stop(52%,#910022), color-stop(100%,#b95d73)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #b95d73 0%,#970e2e 0%,#9c1a38 0%,#910022 52%,#b95d73 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #b95d73 0%,#970e2e 0%,#9c1a38 0%,#910022 52%,#b95d73 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #b95d73 0%,#970e2e 0%,#9c1a38 0%,#910022 52%,#b95d73 100%); /* IE10+ */
background: linear-gradient(top, #b95d73 0%,#970e2e 0%,#9c1a38 0%,#910022 52%,#b95d73 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b95d73', endColorstr='#b95d73',GradientType=0 ); /* IE6-9 */
color: white;
}
#nav a.linkchildflyout
{
background-image: url(Images/arrow.png);
background-position: right center;
background-repeat: no-repeat;
}
You can (and should) use the :before and :after pseudo-elements to achieve such effects.
Here's a Great article on the subject!
Yes there css3 multiple background property. You can write like this:
#nav a.linkchildflyout{
background:linear-gradient(top, #b95d73 0%, #970e2e 0%, #9c1a38 0%, #910022 52%, #b95d73 100%),url(Images/arrow.png) no-repeat right center;
}
Read this for more http://www.css3.info/preview/multiple-backgrounds/