In this project, I built a website/app that estimates or predicts your credit score based on the user's answers. In the beginning of the project development, I created new HTML, CSS, and JavaScript files. In the HTML file, typed in <!doctype html>, <html> tags, <head> tags, <meta> tags, <title> tags, <link> tags, <body> tags, and <script> tags. I linked my CSS file through a <link> tags and JavaScript file through a <script> tags. Next, I typed in <nav> tags inside the <body> tags and inside the <nav> tags I typed in <div> tags and <a> tags to create the navigation menu. After that, I typed in <main> tags. Inside the <main> tags, I typed in <div> tags, <h1> tags, <form> tags, <input> tags, and <p> tags to create the questions and answers for the user. Below the <main> tags, I typed in <footer> tags that has <button> tags, <div> tags, <h5> tags, <p> tags, and <small> tags to create text explaining the disclaimer/terms of use for the website/app.
For the CSS, I typed in:
html {
min-width: 100%;
min-height: 100%;
max-height: 100%;
max-width: 100%;
box-sizing: border-box;
}
body {
width: 100%;
height: auto;
margin: 0;
padding: 0;
background-color: #34C400;
}
to make the website/app responsive to size changes.
Next I typed in:
#navbar {
display: flex;
position: relative;
width: auto;
height: 100%;
margin: 0;
padding: 0;
background-color: #E34D64;
overflow: hidden;
}
#navbar a {
width: 100%;
height: auto;
padding: 20px 15px;
font-family: Baskerville, "Palatino Linotype", Palatino, "Century Schoolbook L", "Times New Roman", "serif";
font-size: 18px;
font-weight: bold;
color: #000000;
text-decoration: none;
}
#navbar a:hover {
background-color: #F3556E;
}
#navBtns {
position: relative;
text-align: center;
vertical-align: middle;
align-content: center;
align-items: center;
line-height: 30px;
border: none;
outline: none;
flex: 1;
}
to give color and size to the navigation menu with some user interface elements that make it easier to know what is clicked.
Next I typed:
#Estimator {
display: block;
position: static;
width: 100%;
height: auto;
margin: 0;
padding: 0px 0px 5px 0px;
background-color: #00FF62;
color: #000000;
font-family: Gotham, "Helvetica Neue", Helvetica, Arial, "sans-serif";
font-weight: normal;
text-align: center;
}
.question {
display: none;
padding-bottom: 1%;
}
.question input[type="button"] {
width: 75px;
height: 50px;
margin: 25px 50px 25px 50px;
padding: 0;
color: #000000;
background-color: #A2EBFF;
border: solid 2px #000000;
border-radius: 5px;
font-family: Gotham, 'Helvetica Neue', Helvetica, Arial, 'sans-serif';
font-weight: bold;
font-size: 16px;
text-align: center;
cursor: pointer;
}
#creditScoreTxt {
display: none;
}
to give color, size, font weight, font family, and position to the main content of the website/app.
Lastly, I typed in:
#ftBtn {
width: 6%;
height: auto;
margin: 0;
padding: 0;
float: right;
cursor: pointer;
}
#upArrow {
width: 37.5%;
height: auto;
margin: 0;
padding: 0;
}
#txtSpace {
background-color: rgba(255,255,255,0.50);
margin: 0 auto;
padding: 0% 0% 2.5% 0%;
clear: both;
}
#ftText {
display: none;
}
#ftHeader {
display: block;
text-align: center;
margin: 0;
padding: 0;
}
@media only screen and (max-device-width : 1024px) {
#ftBtn {
width: 10%;
}
#upArrow {
width: 40%;
}
}
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
#navbar a{
display: block;
}
}
to style the footer with color, size, positioning, fonts, and space while also using the media query to change the navigation bar text positioning when a 320 pixel by 480 pixel screen condition is met.
For the JavaScript, I stored multiple variables from classes of <div> tags and entered them into functions to run the program as intended. The program gets the number 850 which is the maximum credit score a person can get and subtract 70-85 points based on if the user clicks on specific buttons. Then I typed in the code document.getElementById("").style.display to toggle the questions showing up as well as the final score out of 850 at the end of the questions. I used functions like:
function btn8() {
qa8.style.display = "none";
document.getElementById("creditScoreTxt").style.display = "block";
document.getElementById("creditScoreNum").innerHTML = maxCreditScore;
}
to display the next question while hiding the current question when the user clicks a button. Also, I typed:
//Shows or hides the footer when the up arrow is clicked.
function toggle() {
var clickedBtn = document.getElementById("ftText");
if (clickedBtn.style.display == "block") {
clickedBtn.style.display = "none";
}
else {
clickedBtn.style.display = "block";
}
console.log("clickedBtn");
return;
}
which shows or hides the footer.
Knowing how to build a credit score website/app is useful to a web designer since it offers more options the web designer can create and gives knowledge whenever the web designer needs to create a website/app similar to this project.
Link: http://techteach.us/Web2020/ZWeiJian/WCP/Projects/credit_Score_App_P3/Credit_Score_App.html
No comments:
Post a Comment