I've seen these answers already: this, this, this and this.
But it didn't help.
My program is here: http://jsfiddle.net/nav9/6VeB7/9/
Two questions:
1. Does it make sense to have such background code placed within the html
tag or the head
tag instead of inside the body
tag?
2. How do I get a gradient over the background image? It works fine when I place the background image in the html
tag and the gradient in the head
tag, but I want both in the same tag.
The CSS:
body
{
width: 100%;
height: 100%;
margin: 0px 0px 0px 0px;
/*background: radial-gradient(rgba(45,255,27,0.8), rgba(255,162,12,0.87), rgba(14,12,12,1));*/
background: radial-gradient(rgba(45,255,27,0.8), rgba(255,162,12,0.87), rgba(14,12,12,1));/*, url("images/starTile.png") repeat;*/
background-image: url("images/starTile.png") repeat;
position: fixed;
}
The HTML:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<link rel="stylesheet" type="text/css" href="Styles.css">
</body>
</html>
UPDATE:
This is the reason it's not a duplicate: I'm trying to repeat the starTile, and the gradient doesn't work when I use repeat
. But if I use no-repeat
, I can see the gradient as well as a single starTile image.
body
{
background-image: url('images/starTile.png'), radial-gradient(rgba(45,255,27,0.8), rgba(255,162,12,0.87), rgba(14,12,12,1));
background-repeat: repeat, no-repeat;
background-position: left center, left top;
background-size: auto, 100% 100%;
}