Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <div class="container" ng-app="tabPanel">
  <div class="jumbotron" ng-controller="headerCtrl">
    <h1>{{header}}</h1>
    <span>by:</span><a href="http://www.petrusrex.com/" target="_blank"> {{mySite}}</a>
    <br>
    <div class="tab-controller-wrap" ng-controller="tabCtrl" ng-click="tabChange($event)">
      <a href="#awesome1" class="tab-control" ng-class="{'active':tabSelected=='#awesome1'}">Imperial</a>
      <a href="#awesome2" class="tab-control" ng-class="{'active':tabSelected=='#awesome2'}">Metric</a>
      <a href="#awesome3" class="tab-control" ng-class="{'active':tabSelected=='#awesome3'}">BMI Classification</a>
      <hr>
      <div class="content-wrapper">
      <!-- Imperial Calculator -->
        <div id="awesome1" class="ng-hide" ng-show="tabSelected=='#awesome1'">
          <form ng-controller="imperialCtrl">
            <h5>Weight:</h4><input ng-change="computeBMI()" ng-model="statsUS.weightUS"></input><span> lbs.</span>
            <br>
            <br>
            <h5>Height:</h4><input class="input-small" ng-change="computeBmiUS()" ng-model="statsUS.ftUS"></input><span> ft.</span>
            <input class="input-small" ng-change="computeBmiUS()" ng-model="statsUS.inUS"></input><span> in.</span>
            <br>
            <br>
            <b>Your BMI is:</b>
            <h3 class="result">{{statsUS.bmiUS | number: 0}}</h3>
            <br>
          </form>
        </div>
  <!-- Metric Calculator -->
        <div id="awesome2" class="ng-hide" ng-show="tabSelected=='#awesome2'">
           <form ng-controller="metricCtrl">
            <h5>Weight:</h4><input ng-change="computeBmiM()" ng-model="statsM.weightKG"></input><span> kg.</span>
            <br>
            <br>
            <h5>Height:</h4><input class="input-small" ng-change="computeBmiM()" ng-model="statsM.heightCM"></input><span> cm.</span>
            <br>
            <br>
            <b>Your BMI is:</b>
            <h3 class="result">{{statsM.bmiM | number: 0}}</h3>
            <br>
          </form>
        </div>
        <div id="awesome3" class="ng-hide" ng-show="tabSelected=='#awesome3'">
          <div class="row">
            <div class="col-xs-12 col-sm-6">
              <h3>BMI</h3>
              <hr>
                <p>18.5</p>
                <p>18.5–24.9</p>
                <p>25.0–29.9</p>
                <p>30.0–34.9</p>
                <p>35.0–39.9</p>
                <p>≥ 40.0</p>
            </div>
            <div class="chart col-xs-12 col-sm-6">
              <h3>Classification</h3>
              <hr>
                <p>Uderweight</p>
                <p>Normal Weight</p>
                <p>Overweight</p>
                <p>Class I Obesity</p>
                <p>Class II Obesity</p>
                <p>Class III Obesity </p>
            </div>
          
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                $yellow: #ffff84;
$green: #7fff7f;
$orange: #ffa366;
$red-I: #ff7f7f;
$red-II: #ff6666;
$red-III: #ff4c4c;


body {
 background:url('https://www.dropbox.com/s/7zxkiuyghz7z3ss/black-background.jpg?raw=1');
}

.jumbotron{
  margin-top: 5%;
}

.tab-controller-wrap{
  margin-top: 30px;
}

.tab-control, .tab-control:hover, .tab-control.active{
  color: #fff;
  text-decoration: none;
}

.tab-control {
  padding: 10px 20px;
  background-color: #12A5F4;
}

.tab-control:hover{
  background-color: #70c9f8;
}

.tab-control.active{
  background-color: #0a6392;
}

hr{
  border: 1px solid #12A5F4;
}

.tab-wrapper{
  margin-top: 20px;
}

.content-wrapper > div{
  background-color: #fff;
  padding: 20px;
  line-height: 200%;
}

h5{
  display: inline;
  margin-right: 20px;
}

.input-small{
  width: 4%;
}

//Classification Chart

p {
  padding: 10px;
}

p:nth-child(3){
  background-color: $yellow;
}

p:nth-child(4){
  background-color: $green;
}

p:nth-child(5){
  background-color: $orange;
}

p:nth-child(6){
  background-color: $red-I;
}

p:nth-child(7){
  background-color: $red-II;
}

p:nth-child(8){
  background-color: $red-III;
}




              
            
!

JS

              
                var app = angular.module("tabPanel",[]);

app.controller("headerCtrl", function($scope){
  $scope.header = 'BMI Calculator + Metric';
  $scope.mySite = "Petrus Rex";
});

app.controller("tabCtrl",function($scope){
    $scope.tabSelected = "#awesome1";
    $scope.tabChange = function(e){
        if (e.target.nodeName === 'A') {
            $scope.tabSelected = e.target.getAttribute("href");
            e.preventDefault();
        }
    }
});

app.controller('imperialCtrl', function ($scope){
  $scope.statsUS = {
    weightUS: 0,
    ftUS: 0,
    convertFt: 0,
    inUS: 0,
    heightUS: 0,
    bmiUS: 0};
  
  var computeBmiUS = function(){
  //Convert feet to inches
   $scope.statsUS.convertFt = $scope.statsUS.ftUS * 12;
  //Add converted feet & remainder inches
   $scope.statsUS.heightUS = $scope.statsUS.convertFt + parseInt($scope.statsUS.inUS);
  //calculate BMI
    $scope.statsUS.bmiUS = ($scope.statsUS.weightUS * 703) /    ($scope.statsUS.heightUS * $scope.statsUS.heightUS) ;
  }
  //watch DOM input fields
  $scope.$watch('statsUS.weightUS', computeBmiUS);
  $scope.$watch('statsUS.ftUS', computeBmiUS);
  $scope.$watch('statsUS.inUS', computeBmiUS);
});

app.controller('metricCtrl', function($scope){
  //Let M = Metric
  $scope.statsM = {
    weightKG: 0,
    heightCM: 0,
    heightM: 0,
    bmiM: 0
  };
  
  var computeBmiM = function(){
   $scope.statsM.heightM = $scope.statsM.heightCM / 100;
    //calculate BMI
    $scope.statsM.bmiM = ($scope.statsM.weightKG) /    ($scope.statsM.heightM * $scope.statsM.heightM);
  };
   
  $scope.$watch('statsM.heightCM', computeBmiM);
  $scope.$watch('statsM.weightKG', computeBmiM);
});
              
            
!
999px

Console