43 lines
1.4 KiB
HTML
43 lines
1.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<style>
|
|
div {
|
|
width: 600px;
|
|
height: 400px;
|
|
border: 50px solid transparent;
|
|
padding: 50px;
|
|
background-origin: content-box;
|
|
background-clip: content-box;
|
|
background-repeat: no-repeat;
|
|
}
|
|
</style>
|
|
<script>
|
|
var sizeX = 100, sizeY = 80, spaceX = 0, spaceY = 0, width = 600, height = 400;
|
|
|
|
var urls = Array(), size = Array(), position = Array();
|
|
|
|
function addBackground() {
|
|
for (var x = 0; x < width; x += sizeX + spaceX) {
|
|
for (var y = 0; y < height; y += sizeY + spaceY) {
|
|
urls.push("url(resources/circle.png)");
|
|
size.push(sizeX + "px " + sizeY + "px");
|
|
position.push(x + "px " + y + "px");
|
|
}
|
|
}
|
|
|
|
div = document.getElementById("main");
|
|
|
|
div.style.cssText += "background-image: " + urls.join(", ") + ";" +
|
|
"background-size: " + size.join(", ") + ";" +
|
|
"background-position: " + position.join(", ") + ";";
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
<body onload="addBackground()">
|
|
<div id="main" />
|
|
</body>
|
|
</html>
|
|
|