body{
padding:0;
margin:0;
font:normal 12px/16px Arial, Helvetica, sans-serif;
color:#383634;
background-image: -webkit-gradient(
linear,
left top,
left bottom,
color-stop(0.18, rgb(74,12,107)),
color-stop(0.87, rgb(102,153,102))
);
background: -moz-linear-gradient(top, #4a0c6b 0%, #669966 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4a0c6b), color-stop(100%,#669966)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #4a0c6b 0%,#669966 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #4a0c6b 0%,#669966 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #4a0c6b 0%,#669966 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4a0c6b', endColorstr='#669966',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #4a0c6b 0%,#669966 100%); /* W3C */
It goes most of the way down, then repeats
Your original code: http://jsfiddle.net/ecKR4/7/
If you want the gradient to stretch the entire height of the page:
html {
min-height: 100%
}
With little content: http://jsfiddle.net/ecKR4/1/
With lots of content: http://jsfiddle.net/ecKR4/2/
If you want the gradient to be fixed and as high as the viewport:
html {
height: 100%
}
body {
background-attachment: fixed
}
With little content: http://jsfiddle.net/ecKR4/3/
With lots of content: http://jsfiddle.net/ecKR4/4/
If you want the gradient to be as high as the viewport, and then the background colour:
html {
height: 100%
}
body {
background-repeat: no-repeat;
background-color: #669966; /* ending colour of gradient */
}
With little content: http://jsfiddle.net/ecKR4/5/
With lots of content: http://jsfiddle.net/ecKR4/6/
Related
Here is my attempt
.string{
background: #b38f72; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2IzOGY3MiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjIwJSIgc3RvcC1jb2xvcj0iI2QwYjI3ZSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjQwJSIgc3RvcC1jb2xvcj0iI2QzYjg4OCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjYwJSIgc3RvcC1jb2xvcj0iIzhlNjU0NyIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjgwJSIgc3RvcC1jb2xvcj0iIzQwMjExNiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMzZjI4MjQiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
background: -moz-repeating-linear-gradient(-45deg, #b38f72 0%, #d0b27e 0.5%, #d3b888 1%, #8e6547 1.5%, #402116 2%, #3f2824 2.5%); /* FF3.6+ */
background: -webkit-repeating-gradient(linear, left top, right top, color-stop(0%,#b38f72), color-stop(20%,#d0b27e), color-stop(40%,#d3b888), color-stop(60%,#8e6547), color-stop(80%,#402116), color-stop(100%,#3f2824)); /* Chrome,Safari4+ */
background: -webkit-repeating-linear-gradient(left, #b38f72 0%,#d0b27e 20%,#d3b888 40%,#8e6547 60%,#402116 80%,#3f2824 100%); /* Chrome10+,Safari5.1+ */
background: -o-repeating-linear-gradient(left, #b38f72 0%,#d0b27e 20%,#d3b888 40%,#8e6547 60%,#402116 80%,#3f2824 100%); /* Opera 11.10+ */
background: -ms-repeating-linear-gradient(left, #b38f72 0%,#d0b27e 20%,#d3b888 40%,#8e6547 60%,#402116 80%,#3f2824 100%); /* IE10+ */
background: repeating-linear-gradient(to right, #b38f72 0%,#d0b27e 20%,#d3b888 40%,#8e6547 60%,#402116 80%,#3f2824 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b38f72', endColorstr='#3f2824',GradientType=1 ); /* IE6-8 */
height:6px;
width:100%;
margin-top:20px
}
http://jsfiddle.net/HmPkJ/
This is the kind of effect that I'm after.
https://forrst-live.s3.amazonaws.com/posts/snaps/94811/mega.jpg?1310500628
Any help would be appreciated...
You just need 2 gradients, one repeating in horizontal, and another one with semitransparent parts in vertical
.test {
position: absolute;
height: 40px;
width: 100%;
background-image:
linear-gradient(0deg, black 0%, rgba(100, 100, 100, 0.2) 10% , white 50% , rgba(100, 100, 100, 0.2) 90% , gray 100% ),
repeating-linear-gradient(to right, black 0px, white 15px)
;
}
fiddle
Why not just use an 5x5 image and just repeat the pattern ?
Use
background-image: url('data:image/gif;base64,R0lGODdhAgAIAOMQAB0aFSUfDyooKTUxJkA6Gk9EJFlPLFRRSGtnZnNpUHRvXIF3bY+Ifp6Xh7Gunby4rywAAAAAAgAIAAAEDHAERV5xpiW20BFABAA7');
height: 8px;
Demo
<div class="border"></div>
.border {
width: 100%;
height: 6px;
background: -webkit-linear-gradient(left, #2F2727 20%, #1a82f7 80%);
}
The above code produces the line but its fading out the first color than fading in the other one. But i want line like the above one. So help me
.border {
background: -webkit-linear-gradient(left, #2F2727 20%, #1a82f7 20%);
}
Trick is to start the second color right where first color ends. In this example #2F2727 color is ending at 20% and #1a82f7 color is starting from 20%.
You will need to create two separate DOM elements in order to have achieve the multi coloured line. Please see below:
HTML:
<div class="border">
<div></div>
<div></div>
</div>
CSS:
.border {
height:6px
width:100%;
display:block;
overflow:hidden;
}
.border div {
height:6px;
}
.border div:first-child {
width:30%;
background-color:orange;
float:left;
}
.border div:last-child {
width:70%;
background-color:black;
float:left
}
See it in action: http://jsfiddle.net/NvQ7B/2/
could you not just do something like this:
.border {
height:3px;
border-left:200px solid #2F2727;
background-color:#1a82f7;
}
http://www.colorzilla.com/gradient-editor/#ff0000+0,ff0000+30,0a0e0a+30,0a0809+100;Custom
background: #ff0000; /* Old browsers */
background: -moz-linear-gradient(left, #ff0000 0%, #ff0000 30%, #0a0e0a 30%, #0a0809 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#ff0000), color-stop(30%,#ff0000), color-stop(30%,#0a0e0a), color-stop(100%,#0a0809)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #ff0000 0%,#ff0000 30%,#0a0e0a 30%,#0a0809 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, #ff0000 0%,#ff0000 30%,#0a0e0a 30%,#0a0809 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #ff0000 0%,#ff0000 30%,#0a0e0a 30%,#0a0809 100%); /* IE10+ */
background: linear-gradient(to right, #ff0000 0%,#ff0000 30%,#0a0e0a 30%,#0a0809 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff0000', endColorstr='#0a0809',GradientType=1 ); /* IE6-9 */
PROBLEM
I am trying to combine the CSS3 gradient feature along with a background-image sized specifically and placed specifically in the div. Strange thing is that the background-size property not only applies the size to the image, but also the gradient. However I need to keep the image 30px and apply the graident all the way. Any help would be welcomed?
Thanks in advance
CSS
.accordian-head {
height: 50px;
padding: 10px 10px;
background: #ADADAD;
background-image: url(../img/plus-icon.png) 97% 50%;
background-position:97% 50%;
background-repeat:no-repeat; /* fallback */
background-size:30px;
background-image: url(../img/plus-icon.png), -webkit-gradient(linear, left top, left bottom, from(#F4F4F4), to(#ADADAD)); /* Saf4+, Chrome */
background-image: url(../img/plus-icon.png), -webkit-linear-gradient(top, #F4F4F4 0%, #ADADAD 100%); /* Chrome 10+, Saf5.1+ */
background-image: url(../img/plus-icon.png), -moz-linear-gradient(top, #F4F4F4 0%, #ADADAD 100%); /* FF3.6+ */
background-image: url(../img/plus-icon.png), -ms-linear-gradient(top, #F4F4F4 0%, #ADADAD 100%); /* IE10 */
background-image: url(../img/plus-icon.png), -o-linear-gradient(top, #F4F4F4 0%, #ADADAD 100%); /* Opera 11.10+ */
background-image: url(../img/plus-icon.png), linear-gradient(top, #F4F4F4 0%, #ADADAD 100%); /* W3C */
}
You have two layers, one for the image and one for the gradient. When you specify one background-size value, it applies to both layers.
To stretch the gradient you need to explicitly give it its own size:
background-size:30px, 100%;
What you could do is use nested divs, and apply the gradient on top.
<div class="gradient">
<div class="image" style="background-image:url(../img/plus-icon.png)">
</div>
</div>
.gradient {
background: -webkit-gradient(linear, left top, left bottom, from(#F4F4F4), to(#ADADAD));
/* etc */
}
.image {
background-size: 30%;
}
Full page CSS3 Gradient Backgrounds:
Alright so I am trying to make my background be a gradient that is always 100% width and height, and it works, except for the fact that nothing will show up on top of it. Here is the code I currently have.
CSS:
<style type="text/css" media="screen">
#bodyBg{
background:rgb(79,143,249) no-repeat center center fixed; /* Old browsers */
background: -moz-radial-gradient(center, ellipse cover, rgba(164,197,252,1) 1%, rgba(79,143,249,1) 100%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(1%,rgba(164,197,252,1)), color-stop(100%,rgba(79,143,249,1))); /* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover, rgba(164,197,252,1) 1%,rgba(79,143,249,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover, rgba(164,197,252,1) 1%,rgba(79,143,249,1) 100%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover, rgba(164,197,252,1) 1%,rgba(79,143,249,1) 100%); /* IE10+ */
background: radial-gradient(ellipse at center, rgba(164,197,252,1) 1%,rgba(79,143,249,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a4c5fc', endColorstr='#4f8ff9',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
min-height: 100%;
min-width: 1024px;
width: 100%;
height: auto;
position: fixed;
top: 0;
left: 0;
z-index:0;
}
#media screen and (max-width: 1024px) { /* Specific to this particular image */
#bodyBg {
left: 50%;
margin-left: -512px; /* 50% */
}
#body-404 {
position: relative;
margin: 50px auto;
width:880px;
text-align:center;
color:white;
font-family: "Helvetica Neue", "URW Palladio L", Arial, Helvetica, "Palatino Linotype";
z-index:99;
}
</style>
HTML:
<div id="body-404">
<img src="img/logo.png" width="100%">
<h1><span>Sorry the page you were looking for was not found</span></h1>
<p>If you believe you got to this page in error, please contact us via this page.</p><br />
<font size="120%"><a href="index.php">Return to Homepage</font>
</div>
<div id="bodyBg"></div>
DEMO:
http://mysteriousorigin.com/missing.html
It's generally considered poor practice to have empty elements like your #bodyBg. Just put the background gradient on the html (or body) element and get rid of the useless div:
http://jsfiddle.net/2yVRA/1/
html {
background:rgb(79,143,249) no-repeat center center fixed; /* Old browsers */
background: -moz-radial-gradient(center, ellipse cover, rgba(164,197,252,1) 1%, rgba(79,143,249,1) 100%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(1%,rgba(164,197,252,1)), color-stop(100%,rgba(79,143,249,1))); /* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover, rgba(164,197,252,1) 1%,rgba(79,143,249,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover, rgba(164,197,252,1) 1%,rgba(79,143,249,1) 100%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover, rgba(164,197,252,1) 1%,rgba(79,143,249,1) 100%); /* IE10+ */
background: radial-gradient(ellipse at center, rgba(164,197,252,1) 1%,rgba(79,143,249,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a4c5fc', endColorstr='#4f8ff9',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
min-height: 100%;
}
#media screen and (max-width: 1024px) { /* Specific to this particular image */
body-404 {
position: relative;
margin: 50px auto;
width:880px;
text-align:center;
color:white;
font-family: "Helvetica Neue", "URW Palladio L", Arial, Helvetica, "Palatino Linotype";
z-index:99;
}
Use the background-image CSS property instead of using the image tag. I've made a quick jsfiddle to show what I mean. I know it's not exactly what you're going for but you should be able to change it for your use pretty quickly. If not, let me know.
I am having a problem where for some reason in IE the background at the bottom of my page the background isn't expanding. This seeems to work fine in Firefox but not IE. As you can see in the images below.
CSS:
#SecondaryContent
{
background: url(../images/background_slice.png) repeat-y 0% 0%;
width: 18%;
overflow: hidden;
float: left;
}
#Container
{
overflow:hidden;
min-height:100%;
height:auto!IMPORTANT;
height:100%; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' Doesn't seem to work!
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2VkZmRmZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjE4JSIgc3RvcC1jb2xvcj0iI2IzZTllZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjE4JSIgc3RvcC1jb2xvcj0iI2ZmZmZmZiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmZmZmZmYiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); */
background: -moz-linear-gradient(left, #edfdff 0%, #b3e9ef 18%, #ffffff 18%, #ffffff 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#edfdff), color-stop(18%,#b3e9ef), color-stop(18%,#ffffff), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #edfdff 0%,#b3e9ef 18%,#ffffff 18%,#ffffff 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, #edfdff 0%,#b3e9ef 18%,#ffffff 18%,#ffffff 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #edfdff 0%,#b3e9ef 18%,#ffffff 18%,#ffffff 100%); /* IE10+ */
background: linear-gradient(left, #edfdff 0%,#b3e9ef 18%,#ffffff 18%,#ffffff 100%); /* W3C */
/*filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#edfdff', endColorstr='#ffffff',GradientType=1 );*/ /* IE6-8 */
}
I have resolved this myself by using this Javascript to adjust the height of the div to fit around the main div.
<script type="text/javascript">
var theHeight = $("#PrimaryContent").height() + 100;
$('#SecondaryContent').height(theHeight);
</script>