Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <meta name="viewport" content="width=device-width, initial-scale=1">

  <head> 
<link href="https://fonts.googleapis.com/css2?family=Lato&family=Patrick+Hand&display=swap" rel="stylesheet">


    <title> Budget calculate</title>
    <h1> Bill calculate </h1>
  </head>
  <body>
    <p> 50/30/20 budget method help you manage your money </p>
    <ol> 
      <li>The 50/30/20 budget divides your after-tax income into three separate categories: 50% for needs, 30% for wants and 20% for savings/financial goals. </li>
      <li>This approach is best for younger, average-income earners who have paid off their high-interest debt. </li>
      <li>There’s a lot of value in measuring yourself with the 50/30/20 budget</li>
      </ol>
    
    <a href="https://www.thewaystowealth.com/money-management/50-30-20-budget/">click for more info at thewaystowealth</a>
    
  <div class = "container">  
<!--container-->    
  <form action="/submitwage">
    <label for ="income"> Your income: </label>
        <input type="number" id="income" name="income">
      <label for ="people"> How many people you share the bill with: </label>
      <input type = "number" id ="people" name="people">
      </form>
  <button onclick="calculate()">Try it</button>
 
      
   <!-- the calculation-->
   <p> 50% of the budget go to need ( housing,childcare,groceries,bill,etc):</p>
      <div id ="SpendOnNeed">
    <sup>£</sup><span id = "onNeed">0.00</span>
    <small id="each">each</small>
  </div>
      <p> 30% of the budget go to want (eating out, entertainment, hobbies, non essential):</p>
    <div id = "SpendOnWant"><sup>£</sup><span id ="onWant">00.00</span>
  </div>
      <p> 20% of the budget go to saving (fund,saving account,pay off debt):</p>
    <div id ="SpendOnSaving"><sup>£</sup><span id ="onSaving">00.00</span>
  </div>
    </div>
         <!--end-->
        <!--container end-->
      <footer> Thanks for stopping by</footer>
  </body>
  
  
              
            
!

CSS

              
                body{background-color:#72a2ae;
  font-family: 'Patrick Hand', cursive;
   color:white;
     margin: 3em;
     font-size:23px;
     
}
h1{font-size:3.5em;
   text-align:center;
   color:#E27D60;}
a{
  color:#224642;
  position: relative;
  display: inline-block;
  text-decoration-line: underline;
  text-decoration-style: wavy;
}
button {
  border-radius:10%;
  padding: 5px 20px;
  text-align: center;
 display:inline-block;
  font-size: 16px;
  margin: 4px 2px;
  cursor: pointer;
}
button:hover{background-color:#B42F2F;
            color: pink;
            }

 
.container{background-image: linear-gradient(to bottom right,white,#E27D60);
  font-family: 'Lato', sans-serif;
  color: black;
   font-size: 20px;
   box-shadow: 0px 4px 14px grey;
  border-radius:10%;
  margin: 1.5em;
  padding: 3.5em;
  
}
@media only screen and (max-width: 768px) {
  /* For mobile phones: */
  body{font-size:16px;}
  [class*="container"] {
    width: 80%;
    margin:5px;
    padding:5px;
    font-size:16px;
    
  }
}





              
            
!

JS

              
                function calculate (){
  var inCome = document.getElementById("income").value;var people = document.getElementById("people").value;// input
 if (inCome == 0)  alert("Please enter values");
else if (inCome <= 0 || people < 0 )
alert("fault values");
else if (people === "" || people == 0){people = 1;}
else if (people > 0){ people++;}


   //Calculate 
   var spendOnNeed = (50/100)*inCome/people;
  var spendOnWant = (30/100)*inCome;
  var spendOnSaving = (20/100)*inCome;
    
  // fixed and round up
  spendOnNeed = spendOnNeed.toFixed(2);
  spendOnWant = spendOnWant.toFixed(2);
  spendOnSaving =spendOnSaving.toFixed(2);
  //display
     document.getElementById("SpendOnWant").style.display = "block";

document.getElementById("onWant").innerHTML = spendOnWant;
document.getElementById("SpendOnNeed").style.display = "block";
document.getElementById("onNeed").innerHTML= spendOnNeed; document.getElementById("SpendOnSaving").style.display = "block";
document.getElementById("onSaving").innerHTML= spendOnSaving;
 
   
};

              
            
!
999px

Console