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);
}
I am trying to create a button like this (input type="submit"):
using an image that needs to be tiled to achieve the above effect.
I have tried doing this so far:
border: none;
background: url(myImage.png) no-repeat;
background-size: 80px 40px;
padding-left: 40px;
padding-right: 40px;
padding-top: 5px;
padding-bottom: 5px;
But looks like it is a lot of playing around with pixels numbers to achieve the desired effect. Is there an easier way of tiling to achieve this effect.
If you don't want to mess with gradients, here is a simpler way, as I see there isn't actually a gradient in your image, but a two-tone button.
You can achieve this two-tone effect without altering the HTML by using the pseudo-element :before to add a 50% tall, transparent white div.
If you this method you actually have a reflection on your button, so text and icons inside it will also have that "shine" (example).
#login{
background:#444;
display:inline-block;
color:white;
padding:10px 60px;
border-radius:8px;
position:relative;
}
#login:before{
content:'';
width:100%;
height:50%;
background:rgba(255,255,255,0.2);
position:absolute;
top:0px;
left:0px;
}
DEMO: http://jsfiddle.net/ySTbB/
Use CSS3 and border radius
-webkit-border-radius: 11px;
-moz-border-radius: 11px;
border-radius: 11px;
background: rgb(76,76,76); /* Old browsers */
background: -moz-linear-gradient(top, rgba(76,76,76,1) 0%, rgba(89,89,89,1) 12%, rgba(71,71,71,1) 39%, rgba(44,44,44,1) 50%, rgba(0,0,0,1) 51%, rgba(17,17,17,1) 60%, rgba(28,28,28,1) 91%, rgba(19,19,19,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(76,76,76,1)), color-stop(12%,rgba(89,89,89,1)), color-stop(39%,rgba(71,71,71,1)), color-stop(50%,rgba(44,44,44,1)), color-stop(51%,rgba(0,0,0,1)), color-stop(60%,rgba(17,17,17,1)), color-stop(91%,rgba(28,28,28,1)), color-stop(100%,rgba(19,19,19,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(76,76,76,1) 0%,rgba(89,89,89,1) 12%,rgba(71,71,71,1) 39%,rgba(44,44,44,1) 50%,rgba(0,0,0,1) 51%,rgba(17,17,17,1) 60%,rgba(28,28,28,1) 91%,rgba(19,19,19,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(76,76,76,1) 0%,rgba(89,89,89,1) 12%,rgba(71,71,71,1) 39%,rgba(44,44,44,1) 50%,rgba(0,0,0,1) 51%,rgba(17,17,17,1) 60%,rgba(28,28,28,1) 91%,rgba(19,19,19,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(76,76,76,1) 0%,rgba(89,89,89,1) 12%,rgba(71,71,71,1) 39%,rgba(44,44,44,1) 50%,rgba(0,0,0,1) 51%,rgba(17,17,17,1) 60%,rgba(28,28,28,1) 91%,rgba(19,19,19,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(76,76,76,1) 0%,rgba(89,89,89,1) 12%,rgba(71,71,71,1) 39%,rgba(44,44,44,1) 50%,rgba(0,0,0,1) 51%,rgba(17,17,17,1) 60%,rgba(28,28,28,1) 91%,rgba(19,19,19,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4c4c4c', endColorstr='#131313',GradientType=0 ); /* IE6-9 */
SRC: http://www.colorzilla.com/gradient-editor/
If this is the actual image you want to use as background, it would probably be a better idea to just use CSS:
input[type="submit"]
{
border: none;
border-radius: 5px;
background: linear-gradient(to bottom, #AAA 49%, #555 50%);
}
This will work, if button-slice.jpg is a 40px tall, 1px wide jpg "slice" of the background tile pattern.
.button {
display: inline-block;
width: 170px;
height: 40px;
line-height: 40px;
text-align: center;
background: url(button-slice.jpg) repeat-x;
border: 0;
border-radius: 8px;
text-decoration: none;
}
You could also forego images completely and use CSS3 gradients to create that background effect instead, which is probably a better solution if it's only intended for iOS.
Since you can use CSS3 I strongly suggest using it as such:
input[type="submit"] {
background: #3e3e3e;
background: -moz-linear-gradient(top, #616161 0%, #777777 50%, #3b3b3b 51%, #393939 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#616161), color-stop(50%,#777777), color-stop(51%,#3b3b3b), color-stop(100%,#393939));
background: -webkit-linear-gradient(top, #616161 0%,#777777 50%,#3b3b3b 51%,#393939 100%);
background: -o-linear-gradient(top, #616161 0%,#777777 50%,#3b3b3b 51%,#393939 100%);
background: -ms-linear-gradient(top, #616161 0%,#777777 50%,#3b3b3b 51%,#393939 100%);
background: linear-gradient(to bottom, #616161 0%,#777777 50%,#3b3b3b 51%,#393939 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#616161', endColorstr='#393939',GradientType=0 );
border-radius: 6px;
color: white;
min-width: 100px;
padding: 10px 15px;
text-align: center;
text-decoration: none;
}
It'll load a lot faster and render nicer on different DPI devices.
I would use a gradient background with an image as a backup for browsers that do not support gradient. The image bg will tile automatically and the border radius will ensure rounded corners.
DEMO http://jsfiddle.net/kevinPHPkevin/hSwJN/16/
#submit {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius:6px;
display: inline-block;
color: #000;
font-family:'Oswald';
font-size: 20px;
padding: 12px 24px;
border:none;
background:url('http://www.islandpoolnspa.com/More_info_button_background_rot_180.jpg');
background: rgb(76,76,76); /* Old browsers */
background: -moz-linear-gradient(top, rgba(76,76,76,1) 0%, rgba(89,89,89,1) 12%, rgba(71,71,71,1) 39%, rgba(44,44,44,1) 50%, rgba(0,0,0,1) 51%, rgba(17,17,17,1) 60%, rgba(28,28,28,1) 91%, rgba(19,19,19,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(76,76,76,1)), color-stop(12%,rgba(89,89,89,1)), color-stop(39%,rgba(71,71,71,1)), color-stop(50%,rgba(44,44,44,1)), color-stop(51%,rgba(0,0,0,1)), color-stop(60%,rgba(17,17,17,1)), color-stop(91%,rgba(28,28,28,1)), color-stop(100%,rgba(19,19,19,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(76,76,76,1) 0%,rgba(89,89,89,1) 12%,rgba(71,71,71,1) 39%,rgba(44,44,44,1) 50%,rgba(0,0,0,1) 51%,rgba(17,17,17,1) 60%,rgba(28,28,28,1) 91%,rgba(19,19,19,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(76,76,76,1) 0%,rgba(89,89,89,1) 12%,rgba(71,71,71,1) 39%,rgba(44,44,44,1) 50%,rgba(0,0,0,1) 51%,rgba(17,17,17,1) 60%,rgba(28,28,28,1) 91%,rgba(19,19,19,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(76,76,76,1) 0%,rgba(89,89,89,1) 12%,rgba(71,71,71,1) 39%,rgba(44,44,44,1) 50%,rgba(0,0,0,1) 51%,rgba(17,17,17,1) 60%,rgba(28,28,28,1) 91%,rgba(19,19,19,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(76,76,76,1) 0%,rgba(89,89,89,1) 12%,rgba(71,71,71,1) 39%,rgba(44,44,44,1) 50%,rgba(0,0,0,1) 51%,rgba(17,17,17,1) 60%,rgba(28,28,28,1) 91%,rgba(19,19,19,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4c4c4c', endColorstr='#131313',GradientType=0 ); /* IE6-9 */
}
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.