Skip to content

Commit

Permalink
adding starting project
Browse files Browse the repository at this point in the history
  • Loading branch information
poudelb1 committed Nov 8, 2022
1 parent d1583f4 commit 330e696
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
18 changes: 18 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Gradient Background</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body id="gradient">
<h1>Background Generator</h1>
<input class = "color1" type="color" name="color1" value="#00ff00">
<input class="color2" type="color" name="color2" value="#ff0000">
<h2>Current CSS Background</h2>
<h3></h3>
<script type="text/javascript" src="script.js"></script>

</body>
</html>
20 changes: 20 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var css = document.querySelector("h3");
var color1 = document.querySelector(".color1");
var color2 = document.querySelector(".color2");
var body = document.getElementById("gradient");


function setGradient() {
body.style.background =
"linear-gradient(to right, "
+ color1.value
+ ", "
+ color2.value
+ ")";

css.textContent = body.style.background + ";";
}

color1.addEventListener("input", setGradient);

color2.addEventListener("input", setGradient);
27 changes: 27 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
body {
font: 'Raleway', sans-serif;
color: rgba(0,0,0,.5);
text-align: center;
text-transform: uppercase;
letter-spacing: .5em;
top: 15%;
background: linear-gradient(to right, red , yellow); /* Standard syntax */
}

h1 {
font: 600 3.5em 'Raleway', sans-serif;
color: rgba(0,0,0,.5);
text-align: center;
text-transform: uppercase;
letter-spacing: .5em;
width: 100%;
}

h3 {
font: 900 1em 'Raleway', sans-serif;
color: rgba(0,0,0,.5);
text-align: center;
text-transform: none;
letter-spacing: 0.01em;

}

0 comments on commit 330e696

Please sign in to comment.