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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                <html>
  <head>
    <title>Hey</title>
  </head>
  <body>
    <center>
      <div class="wrapper">
        <h1>Health Advisor</h1>
        <br />
        <section id="showme" class="display">0</section>
        <!-- Fruits inputs -->
        <select id="fruitsup" onchange="fruitsup()">
          <option value="apple">Apple</option>
          <option value="banana">Banana</option>
          <option value="grapes">Grapes</option>
          <option value="orange">Orange</option>
          <option value="pear">Pear</option>
          <option value="peach">Peach</option>
          <option value="pineapple">Pineapple</option>
          <option value="strawberry">Strawberry</option>
          <option value="watermelon">Watermelon</option>
          <option value="custom">Custom Value</option>
        </select>
        <input
          id="fruit"
          type="number"
          pattern="[0-9]{10}"
          value="0"
          placeholder="Fruit Calories"
        />
        <!-- Exercises -->
        <select id="exercises" onchange="exercises()">
          <option value="golf">Golf (using cart) </option>
          <option value="walking">Walking (3.5 mph) </option>
          <option value="kayaking">Kayaking</option>
          <option value="softball">Softball/Baseball </option>
          <option value="swimming">Swimming (free-style, moderate) </option>
          <option value="tennis">Tennis (general) </option>
          <option value="running">Running (9 minute mile) </option>
          <option value="bicycling">Bicycling (12-14 mph, moderate) </option>
          <option value="football">Football (general) </option>
          <option value="custom">Custom Value</option>
        </select>
        <input
          id="burn"
          type="number"
          pattern="[0-9]{10}"
          value="0"
          placeholder="Calories Burned"
        />
        <br />
        <!-- super dude buttons -->
        <div class="btn-col">
          <div class="btn-row">
            <button>1</button>
            <button>2</button>
            <button>3</button>
          </div>
          <div class="btn-row">
            <button>4</button>
            <button>5</button>
            <button>6</button>
          </div>
          <div class="btn-row">
            <button>7</button>
            <button>8</button>
            <button>9</button>
          </div>
          <div>
            <button>0</button>
          </div>
        </div>
        <button class="sumbit-btn">Check My Health</button>
      </div>
    </center>
  </body>
  
</html>
              
            
!

CSS

              
                    body {
        background: #f3f2f1;
        font-family: Helvetica, Arial, sans-serif;
        -webkit-font-smoothing: antialiased;
        color: #333;
        margin: 0;
      }

      h1,
      h2,
      h3 {
        margin: 0;
        padding: 0;
      }
      .wrapper {
        width: 100%;
        max-width: 700px;
        margin: 0 auto;
        margin-top: 1.8%;
        border: 0.1px solid #444444;
        background-color: white;
        border-radius: 2px;
        box-shadow: 0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132),
          0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108);
        opacity: 0.96;
        transition: all 0.15s linear;
        position: relative;
        overflow: hidden;
        padding: 12px;
      }
      /* display outputs*/
      .display {
        height: 80px;
        width: 650px;
        border: 1px solid #010101;
        text-align: left;
        font-size: 40px;
        text-indent: 10px;
        margin-bottom: 16px;
        overflow: hidden;
        word-break: break-word;
        text-overflow: ellipsis;
        padding: 2px 5px;
      }
      select {
        width: 319px;
        height: 54px;
        padding-top: 9px;
        padding-left: 19px;
        font-size: 18px;
        cursor: pointer;
        border: 1px solid #010101;
        background: #ffffff;
      }

      input[type="number"] {
        width: 304px;
        height: 45px;
        padding-left: 22px;
        padding-top: 9px;
        border: 0.1px solid #010101;
        font-size: 18px;
        margin-bottom: 18px;
      }
      button {
        background-color: #fff;
        color: black;
        height: 100px;
        width: 24.5%;
        border: none;
        border-radius: 0;
        font-size: 40px;
        cursor: pointer;
        border: 0.1px solid #010101;
      }
      .btn-col {
        width: 400px;
        margin-bottom: 18px;
      }
      .btn-row {
        display: flex;
        align-content: stretch;
        justify-content: space-between;
        margin-bottom: 2.5%;
      }
      .sumbit-btn {
        border: none;
        height: 50px;
        width: 240px;
        margin-top: 20px;
        font-size: 18px;
        text-transform: uppercase;
        background: #010101;
        color: #f1f1f1;
        margin-bottom: 18px;
      }
      .sumbit-btn:hover {
        box-shadow: 0 3.2px 7.2px 0 rgba(0, 0, 0, 0.132),
          0 0.6px 1.8px 0 rgba(0, 0, 0, 0.108);
        opacity: 0.96;
        transition: all 0.15s linear;
      }
              
            
!

JS

              
                //global config
      let buffer = "";
      let runningTotal = 0;
      let previousValue;
      var display = document.getElementById("showme");
      var fruitInput = document.getElementById("fruit").value;
      var burnInput = document.getElementById("burn").value;
      //   var selectfruit = document.getElementById("fruitsup").value;
      //   var exercises = document.getElementById("exercises").value;

      // button events
      document
        .querySelector(".btn-col", "button")
        .addEventListener("click", function(event) {
          updateValue(event.target.innerText);
        });

      // show only numbers
      function updateValue(value) {
        if (isNaN(parseInt(value))) {
          console.log("error dude");
        } else {
          handleNumber(value);
        }
        rerender();
      }
      // store and verfiy number value
      function handleNumber(value) {
        if (buffer === "0") {
          buffer = value;
        } else {
          buffer += value;
        }
      }

      // display output value
      function rerender() {
        console.log(buffer);
        display.innerText = buffer;
      }

      //onchange function
      function fruitsup() {
        var selectfruit = document.getElementById("fruitsup").value;
        document.getElementById("fruit").value = "12234";
      }
      //
      function exercises() {
        var exercises = document.getElementById("exercises").value;
        document.getElementById("burn").value = "3456543";
      }

      // sumbit btn function
      document
        .querySelector(".sumbit-btn")
        .addEventListener("click", function(event) {});
              
            
!
999px

Console