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 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

              
                <div class="calc-container" ng-app="main" ng-controller="MainCtrl">
  
  <div class="calc-logo">
    <img src="https://8km.com.ua/images/logo.png" alt="Логотип ТОВ «Автогазцентр»" width="160"/>
    <h2>Оцінка витрат ГБО</h2>
  </div>
  
  <div class="calc-content">
    
    <div class="calc-left">  
      <div>
        <label>
          <span class="label-text">Вартість ГБО:</span>        
          <input type="number" min="2" ng-init="gboPrice = 16000.00" ng-model="gboPrice">
          <span>грн.</span>
        </label>
      </div>
      <div>
        <label>
          <span class="label-text">Ціна 1л бензина:</span>
          <input type="number" min="2" ng-init="petrolPrice = 20.00"  ng-model="petrolPrice">
          <span>грн.</span>
        </label>
      </div>
      <div>
        <label>
          <span class="label-text">Ціна 1л газа:</span>
          <input type="number" min="0" ng-init="gasPrice = 7.90" ng-model="gasPrice">
          <span>грн.</span>
        </label>
      </div>
      <div>
        <label>
          <span class="label-text">Витрати бензину на 100км:</span>
          <input type="number" min="1" ng-init="petrol100kmCost = 10.00" ng-model="petrol100kmCost">
        </label>
        <span>грн.</span>
      </div>
    </div>  
    
    <div class="calc-right">
      <div>
        <span class="label-text">Вартість бензину на 100км:</span>
        <span class="calc-result">{{ petrol100kmPrice() | currency:"":2 }}</span>
        <span>грн.</span>  
      </div>
      <div>
        <span class="label-text">Вартість газу на 100км:</span>
        <span class="calc-result">{{ gas100kmPrice() | currency:"":2 }}</span>
        <span>грн.</span>
      </div>
      <div>
        <span class="label-text">Економія при пробігу 100км:</span>
        <span class="calc-result">{{ saving100km() | currency:"":2 }}</span>
        <span>грн.</span>
      </div>
      <div>
        <span class="label-text">Окупність ГБО через -</span>
        <span class="calc-result">{{ gboReturn() | currency:"":2 }}</span>
        <span class="calc-result-km">км.</span>
      </div>
</div>
    
  </div>
 
</div>
              
            
!

CSS

              
                .calc-container {
  width: 900px;
  min-height: 485px;
  background: #252525;
  margin: 0 auto;
}

.calc-logo {
  height: 257px;
  text-align: center;
}

.calc-logo img {
  margin-top: 42px;
}

.calc-logo h2 {
  color: #fff;
  font-size: 30px;
  font-family: Helvetica, Arial;
}

.calc-content {
  padding: 25px 40px;
  min-height: 125px;
  background: #ffb916;
}

.calc-left {
  float: left;
  width: 50%;
}

.calc-left > div{
  margin: 5px 0;
}

.calc-left .label-text{
  min-width: 185px;
  display: inline-block;
  text-align: right;
  margin: 5px 5px 0 0;
}

.calc-left input,
.calc-right .calc-result {
  border-radius: 10px;
  padding: 0 5px;
  min-width: 133px;
  border: 1px solid #888;
  font-size: 14px;
}

.calc-right {
  float: right;
  width: 50%;    
  text-align: right;
  margin-top: 2px;
}

.calc-right > div{
  margin-top: 3px;
}

.calc-right .calc-result {
  background: #fff;
  display: inline-block;
  height: 15px;
  margin: 8px 0 -5px 5px;
}

.calc-right .calc-result-km {
  margin-left: 6px;
}
              
            
!

JS

              
                angular.module('main',[])
.controller('MainCtrl',['$scope', function($scope)
{
  $scope.petrol100kmPrice = function()
  {
    if($scope.petrol100kmCost && $scope.petrolPrice)
      return ($scope.petrol100kmCost * $scope.petrolPrice);
  }
  
  $scope.gas100kmPrice = function()
  {
    if($scope.petrol100kmCost && $scope.gasPrice)
      return (($scope.petrol100kmCost + ($scope.petrol100kmCost * 0.2)) * $scope.gasPrice);
  }
    
  $scope.saving100km = function()
  {
    if($scope.petrol100kmCost && $scope.petrolPrice && $scope.gas100kmPrice())
      return ($scope.petrol100kmCost * $scope.petrolPrice - $scope.gas100kmPrice());
  }
  
  $scope.gboReturn = function()
  {
    if($scope.gboPrice && $scope.saving100km())
      return ($scope.gboPrice * 100 / $scope.saving100km() );
  }  
}])
;


              
            
!
999px

Console