-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Akshatverma01/unitConvertor
Added Length Convertor
- Loading branch information
Showing
3 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Length-Converter</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
|
||
<div class="container"> | ||
<h1 id="heading">Length-Convertor</h1> | ||
<div class="content"> | ||
|
||
<div class="content1"> | ||
<label for="feet">feet</label><br> | ||
<input type="number" value="1" id="feet" class="content2"> | ||
</div> | ||
|
||
<div class="content1"> | ||
<h1>=</h1> | ||
</div> | ||
|
||
<div class="content1"> | ||
<label for="inch">inches</label><br> | ||
<input type="number" value="1" id="inch" class="content2"> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
|
||
<script src="script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var feet = document.getElementById('feet') | ||
var inch = document.getElementById('inch') | ||
|
||
|
||
feet.addEventListener('input', function(){ | ||
|
||
let f= this.value | ||
let i= f*12 | ||
inch.value=i | ||
|
||
}); | ||
|
||
inch.addEventListener('input', function(){ | ||
|
||
let i= this.value | ||
let f= i/12 | ||
|
||
if(!Number.isInteger(f)){ | ||
f=f.toFixed(2); | ||
} | ||
feet.value=f | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
*{ | ||
margin: 0; | ||
padding: 0; | ||
box-sizing: border-box; | ||
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; | ||
text-transform: uppercase; | ||
} | ||
|
||
label{ | ||
text-transform: capitalize; | ||
font-weight: 600; | ||
} | ||
|
||
#heading{ | ||
text-align: center; | ||
font-size: 3rem; | ||
margin-top: 50px; | ||
color: rgb(32, 5, 56); | ||
font-weight: 800; | ||
} | ||
|
||
#heading::after{ | ||
content: " "; | ||
height: 5px; | ||
width: 510px; | ||
display: block; | ||
background-color: rgb(33, 5, 61); | ||
position: absolute; | ||
margin: 10px auto; | ||
left:32%; | ||
} | ||
|
||
.container{ | ||
background-color: rgba(111, 26, 190, 0.829); | ||
margin-top: 10%; | ||
padding: 20px; | ||
height: 50%; | ||
width: 70%; | ||
border-radius: 30px; | ||
align-items: center; | ||
justify-content: center; | ||
box-shadow: inset 10px 20px 30px rgba(170, 125, 207, 0.308); | ||
/* box-shadow: 0px 10px 15px rgba(52, 14, 87, 0.945) ; */ | ||
} | ||
|
||
|
||
body{ | ||
width: 100%; | ||
height: 100vh; | ||
display: flex; | ||
align-self: center; | ||
justify-content: center; | ||
background-color: rgb(78, 14, 116); | ||
} | ||
|
||
.content{ | ||
display: flex; | ||
text-align: center; | ||
margin: 6% 15%; | ||
align-items: center; | ||
justify-content: center; | ||
background-color: rgb(148, 73, 219); | ||
font-size: 20px; | ||
height: 100px; | ||
width: fit-content; | ||
font-weight: 600; | ||
border-radius: 10px; | ||
padding: 10px 0; | ||
box-shadow: inset 0px 10px 10px rgba(170, 114, 223, 0.308); | ||
} | ||
.content1{ | ||
display:inline-block; | ||
} | ||
|
||
.content2{ | ||
padding: 5px 10px; | ||
font-size: 2rem; | ||
font-weight: 600; | ||
width: 300px; | ||
height: 50px; | ||
text-align: center; | ||
border-radius: 10px; | ||
border:0; | ||
margin: 10px; | ||
border: 2px solid rgb(99, 6, 99); | ||
} |