Budget Performance As Edited By James

startv
User Gravatar

Pen Settings

↑ Insert the most common viewport meta tag

Add-ons for Sass (.scss)

Just like a real project, use these lines at the top of your CSS to import them as a dependency.

  • @import "susy";
  • @import "breakpoint";
  • @import "compass";
  • @import "color-schemer";
  • @import "bourbon";
  • @import "neat";
  • @import "modular-scale";

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource
via CSS Lint

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource
via JS Hint

Code Indentation

     

Save Automatically?

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

Want a Run Button?

If active, the preview will update automatically when you change code.

HTML

HTML

x
</html>
1
<html>
2
  <head>
3
    <h1>Budget Performance as Edited by James </h1>
4
  </head>
5
  
6
<div class="b">
7
  <div class="b-header">
8
    <h2 class="b-title" contenteditable> Template Table </h2>
9
    <em class="b-size">Budget: <span contenteditable>800</span>KB</em>
10
  </div><!--end b-header-->
11
  <div class="b-budget">
12
    <div class="b-cat-container">
13
      <em class="actual-size">Actual: <span>60</span>KB</em>
14
      <ul class="b-cat-list">
15
        <li class="b-cat b-cat-html">

CSS

CSS

238
207
208
footer {
209
  margin-top: 4em;
210
  color: #d5c9a5;
211
  text-align: center;
212
  
213
  a {
214
    color: #d5c9a5;
215
    
216
    &:hover, &:focus {
217
      color: #EF944D;
218
    }
219
  }
220
}
221
222
@keyframes shake {
223
  10%, 90% {
224
    transform: translate3d(-1px, 0, 0);
225
  }
226
  
227
  20%, 80% {
228
    transform: translate3d(2px, 0, 0);
229
  }
230
231
  30%, 50%, 70% {
232
    transform: translate3d(-4px, 0, 0);

JS

JS

x
});
56
}
57
58
//Set Actual Size
59
function setActualSize(scope,val) {
60
  actualSize = val;
61
  scope.find('.actual-size span').text(val);
62
}
63
64
//Determine if actual size is within budget
65
function budgetOverUnder(scope) {
66
  var budgetSize = parseInt(scope.find('.b-size span').text());
67
  var actualSize = parseInt(scope.find('.actual-size span').text());
68
  var totalSize = actualSize/budgetSize;
69
  
70
  //If actual val is over budget
71
  if(totalSize>1) {
72
    scope.find('.b-header, .actual-size').addClass('has-error');
73
   scope.find('.b-cat-container').width('100%');
74
  } else {
75
    scope.find('.b-header, .actual-size').removeClass('has-error');
76
    scope.find('.b-cat-container').width(totalSize*100+'%');
77
  }
0px
Loading ..................

JS Console

Template Table

Budget: 800KB
Actual: 60KB