cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

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

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

Code Indentation

     

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.

            
              <div class='wrapper user'>
  <div class="container">

    <div class="top">
      <h1 id="welcome">Welcome, Test.</h1>
      <a class="btn" >Log out</a>
    </div>

    <div class="todaysmeals">
      <div class="mealstop">
        <h4><img src="https://fast-earth-50951.herokuapp.com/images/meals-icon.png"> Today's Meals</h4>
        <a href="/meals" class="btn" id="addmealbutton">Add a meal</a>
      </div>
      <ul id="todaymeals">
        <li data-id="39">
          <div class="info">
            <div class="metadata">
              <h3>breakfast</h3>
              <span class="time">8PM today</span>
              <a class="iconclick"><i class="fa fa-pencil"></i></a>
              <form class="single" >
                <button type="submit"><i class="fa fa-trash"></i></button>
              </form>
            </div>
            <p class="ingredients">coffee, instant oatmeal, 3 bananas, a donut</p>
            <p class="comments">Breakfast</p>
          </div>
          <div class="nutrients">
            <div class="sodium">
              <label>Sodium</label>
              <span class="neutral">282mg</span>
            </div>
            <div class="protein">
              <label>Protein</label>
              <span class="neutral">10g</span>
            </div>
            <div class="carbs">
              <label>Carbs</label>
              <span class="warn">128g</span>
            </div>
            <div class="fiber">
              <label>Fiber</label>
              <span class="good">13g</span>
            </div>
          </div>
        </li>

        <li data-id="40">
          <div class="info">
            <div class="metadata">
              <h3>supper</h3>
              <span class="time">8PM today</span>
              <a class="iconclick" href="/meals/40"><i class="fa fa-pencil"></i></a>
              <form class="single" action="/meals/delete/40?_method=DELETE" method="POST">
                <button type="submit"><i class="fa fa-trash"></i></button>
              </form>
            </div>
            <p class="ingredients">calzone</p>
            <p class="comments">Super tasty!</p>
          </div>
          <div class="nutrients">
            <div class="sodium">
              <label>Sodium</label>
              <span class="warn">2938mg</span>
            </div>
            <div class="protein">
              <label>Protein</label>
              <span class="good">66g</span>
            </div>
            <div class="carbs">
              <label>Carbs</label>
              <span class="good">55g</span>
            </div>
            <div class="fiber">
              <label>Fiber</label>
              <span class="neutral">3g</span>
            </div>
          </div>
        </li>
      </ul>
    </div>

    <div class="tabntr">

      <div id="tabs" class="tbbr">
        <div class="tabnav tab-nav">
          <ul>
            <li class="tablink actv" id="pantrytab"><img src="https://fast-earth-50951.herokuapp.com/images/pantry-icon.png"> Pantry</li>
            <li class="tablink" id="mealstab"><img src="https://fast-earth-50951.herokuapp.com/images/weekly-icon.png"> Weekly Meals</li>
          </ul>
        </div>

        <div id="tabcontent">
          <div class="foods actv tabcont">
            <a class="btn" href="/foods">Add Foods</a>
            <ul id="pantrycontainer">

              <li class="pantryitem" data-id="108">
                <div class="foodsub first">
                  <img src="https://d2xdmhkmkbyw75.cloudfront.net/5673_highres.jpg">
                  <h2 class="foodname">
    cheese croissant
  </h2>
                </div>
                <div class="foodsub second">
                  <h3><label>Added on</label>Wednesday, 9AM </h3>
                </div>
                <div class="foodsub third">
                  <span class="neutral"><i class="fa fa-circle"></i> Protein <span class="tooltip">6.72g</span></span>
                  <span class="neutral"><i class="fa fa-circle"></i> Sodium <span class="tooltip">263.53mg</span></span>
                  <span class="neutral"><i class="fa fa-circle"></i> Carbs <span class="tooltip">34.31g</span></span>
                </div>

                <div class="foodsub fourth">
                  <button class="archive">Archive</button>
                  <button class="delete">Delete</button>
                </div>


              </li>


              <li class="pantryitem" data-id="107">
                <div class="foodsub first">
                  <img src="https://d2xdmhkmkbyw75.cloudfront.net/217_highres.jpg">
                  <h2 class="foodname">ham</h2>
                </div>
                <div class="foodsub second">
                  <h3><label>Added on</label>Wednesday, 9AM </h3>
                </div>
                <div class="foodsub third">
                  <span class="good"><i class="fa fa-circle"></i> Protein <span class="tooltip">29.72g</span></span>
                  <span class="warn"><i class="fa fa-circle"></i> Sodium <span class="tooltip">1309.18mg</span></span>
                  <span class="good"><i class="fa fa-circle"></i> Carbs <span class="tooltip">1.42g</span></span>
                </div>

                <div class="foodsub fourth">
                  <button class="archive">Archive</button>
                  <button class="delete">Delete</button>
                </div>


              </li>


            </ul>
          </div>
          <div class="meals tabcont">
            <ul>


              <li data-id="40">
                <div class="info">
                  <div class="metadata">
                    <h3>supper</h3>
                    <span class="time">8PM today</span>
                    <a class="iconclick" ><i class="fa fa-pencil"></i></a>
                    <form class="single">
                      <button type="submit"><i class="fa fa-trash"></i></button>
                    </form>
                  </div>
                  <p class="ingredients">calzone</p>
                  <p class="comments">Super tasty!</p>
                </div>
                <div class="nutrients">
                  <div class="sodium">
                    <label>Sodium</label>
                    <span class="warn">2938mg</span>
                  </div>
                  <div class="protein">
                    <label>Protein</label>
                    <span class="good">66g</span>
                  </div>
                  <div class="carbs">
                    <label>Carbs</label>
                    <span class="good">55g</span>
                  </div>
                  <div class="fiber">
                    <label>Fiber</label>
                    <span class="neutral">3g</span>
                  </div>
                </div>
              </li>


              <li data-id="39">
                <div class="info">
                  <div class="metadata">
                    <h3>breakfast</h3>
                    <span class="time">8PM today</span>
                    <a class="iconclick" ><i class="fa fa-pencil"></i></a>
                    <form class="single" >
                      <button type="submit"><i class="fa fa-trash"></i></button>
                    </form>
                  </div>
                  <p class="ingredients">coffee, instant oatmeal, 3 bananas, a donut</p>
                  <p class="comments">Breakfast</p>
                </div>
                <div class="nutrients">
                  <div class="sodium">
                    <label>Sodium</label>
                    <span class="neutral">282mg</span>
                  </div>
                  <div class="protein">
                    <label>Protein</label>
                    <span class="neutral">10g</span>
                  </div>
                  <div class="carbs">
                    <label>Carbs</label>
                    <span class="warn">128g</span>
                  </div>
                  <div class="fiber">
                    <label>Fiber</label>
                    <span class="good">13g</span>
                  </div>
                </div>
              </li>


              <li data-id="38">
                <div class="info">
                  <div class="metadata">
                    <h3>lunch</h3>
                    <span class="time">2PM Fri</span>
                    <a class="iconclick"><i class="fa fa-pencil"></i></a>
                    <form class="single">
                      <button type="submit"><i class="fa fa-trash"></i></button>
                    </form>
                  </div>
                  <p class="ingredients">boiled egg, peanut butter, cheese, crackers, grapes</p>
                  <p class="comments">Quick lunch!</p>
                </div>
                <div class="nutrients">
                  <div class="sodium">
                    <label>Sodium</label>
                    <span class="neutral">115mg</span>
                  </div>
                  <div class="protein">
                    <label>Protein</label>
                    <span class="neutral">6g</span>
                  </div>
                  <div class="carbs">
                    <label>Carbs</label>
                    <span class="good">11g</span>
                  </div>
                  <div class="fiber">
                    <label>Fiber</label>
                    <span class="neutral">0g</span>
                  </div>
                </div>
              </li>


              <li data-id="37">
                <div class="info">
                  <div class="metadata">
                    <h3>breakfast</h3>
                    <span class="time">9AM Wed</span>
                    <a class="iconclick"><i class="fa fa-pencil"></i></a>
                    <form class="single" action="/meals/delete/37?_method=DELETE" method="POST">
                      <button type="submit"><i class="fa fa-trash"></i></button>
                    </form>
                  </div>
                  <p class="ingredients">orange, croissant</p>
                  <p class="comments">Breakfast breakfast!</p>
                </div>
                <div class="nutrients">
                  <div class="sodium">
                    <label>Sodium</label>
                    <span class="neutral">313mg</span>
                  </div>
                  <div class="protein">
                    <label>Protein</label>
                    <span class="neutral">6g</span>
                  </div>
                  <div class="carbs">
                    <label>Carbs</label>
                    <span class="good">47g</span>
                  </div>
                  <div class="fiber">
                    <label>Fiber</label>
                    <span class="neutral">4g</span>
                  </div>
                </div>
              </li>


            </ul>
          </div>
        </div>
      </div>

      <div class="nutritiontrack" id="nutritionfacts">
        <div id="nutabs" class="tabbr">
          <div class="nutnav tab-nav">
            <ul>
              <li class="nulink actv">Today's Nutrition</li>
            </ul>
          </div>
          <div id="nutabcontent">
            <div class="nucontent actv">


              <p class="nutritionintro">All nutrition is based on the FDA's guidelines for a 2000-calorie diet.</p>
              <div id="data-bar"><svg width="225" height="300"><rect width="301.5" height="50" x="0" y="0" fill="rgba(240,63,53,0.5)"></rect><rect width="342" height="50" x="0" y="60" fill="rgba(50,182,122,0.5)"></rect><rect width="137.25" height="50" x="0" y="120" fill="rgba(240,207,97,0.5)"></rect><rect width="144" height="50" x="0" y="180" fill="rgba(240,207,97,0.5)"></rect><text x="50" y="30" style="fill: black;">Sodium: 134%</text><text x="50" y="90" style="fill: black;">Protein: 152%</text><text x="50" y="150" style="fill: black;">Carbs: 61%</text><text x="50" y="210" style="fill: black;">Fiber: 64%</text></svg></div>
            </div>
          </div>
        </div>

      </div>

    </div>

    <div class="archives">
      <h3 class="title">Your Archive</h3>
      <ul id="archive">


        <li class="archiveitem" data-id="106">


          <div class="foodsub first">
            <img src="https://d2xdmhkmkbyw75.cloudfront.net/1904_highres.jpg">
            <h2 class="foodname">
    clementines
  </h2>
          </div>
          <div class="foodsub second">
            <h3><label>Added on</label>Wednesday, 9AM </h3>
          </div>
          <div class="foodsub third">
            <span class="neutral"><i class="fa fa-circle"></i> Protein <span class="tooltip">0.63g</span></span>
            <span class="neutral"><i class="fa fa-circle"></i> Sodium <span class="tooltip">0.74mg</span></span>
            <span class="good"><i class="fa fa-circle"></i> Carbs <span class="tooltip">8.89g</span></span>
          </div>


        </li>


      </ul>
    </div>

  </div>
</div>
            
          
!
            
              /* ------ end reset.css, begin jbase */

/* button & input reset */
button, input, textarea {
    background: none;
    border: 0;
    color: inherit;
    /* cursor: default; */
    font: inherit;
    line-height: normal;
    overflow: visible;
    padding: 0;
    -webkit-appearance: button; /* for input */
    -moz-appearance:button;
}
input::-moz-focus-inner,
button::-moz-focus-inner,
textarea::-moz-focus-inner,
select::-moz-focus-inner {
    border: 0;
    padding: 0;
}
button:focus, input:focus, textarea:focus, a:focus, select:focus {
  outline:none;
}

/* select fields */

select {
      border: 0 !important;  
      -webkit-appearance: none;  
      -moz-appearance: none; 
}

select option {
  text-align: center;
}



$brand: #32B67A;
$brand2: #0E38B1;
$accent: #F0CF61;
$accent-light: #EBE8E1;
$warn: #F03F35;

$bgr: "brandon-grotesque", helvetica, sans-serif;
$altg: "alternate-gothic-no-2-d", impact, sans-serif;
$ltn: "leitura-news", georgia, sans-serif;

$pencilbrdr: 1px solid #eee;


/* ============= Body */
body {
  font-family: $bgr;
}

.container {
  padding-top: 50px;
  max-width: 90vw;
  margin: 0 auto;
  @media screen and (min-width: 1200px) {
    max-width: 80vw;
  }
}

.wrapper {
  min-height: 90vh;
  padding-bottom: 10vh;
}

.iconclick {
  cursor: pointer;
    color: #ccc;
    transition: 0.2s all;
    &:hover {
      color: $brand;
      transition: 0.2s all;
    }
}

.single {
  display: inline-block;
  button {
    cursor: pointer;
    color: #ccc;
    transition: 0.2s all;
    &:hover {
      color: $warn;
      transition: 0.2s all;
    }
  }
  
}

.base-button {
    font-size: 1.8em;
    margin: 20px;
    padding: 5px 40px;
    background-color: $brand2;
    color: $accent-light;
    border-radius: 30px;
    cursor: pointer;
    transition: 0.3s all;

    &:hover {
      background-color: $brand;
      transition: 0.3s all;
    }
}

/* ===================== DASHBOARD */

.user {
  background-color: lighten($accent-light, 7);
}
.top {
  display: flex;
  align-items: center;
  h1 {
    font-size: 3em;
    font-family: $ltn;
    margin-right: 30px;
  }
  .btn {
    text-decoration: none;
    margin: 0 10px;
    color: white;
    background-color: $warn;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 1.2rem;
  }
}


.dash-container {
  background-color: white;
  margin: 20px 15px;
  padding: 50px;
  border-radius: 5px;
}

/* ============ TODAYS MEALS ============ */

.todaysmeals {
  @extend .dash-container; 
  .mealstop {display: flex; align-items: center;}
  .btn {
    display: block;
    text-decoration: none;
    margin: 0 10px;
    color: white;
    background-color: $brand2;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 1.2rem;
  }
  h4 {
    font-family: $altg;
    font-size: 2em;
    img {
      max-height: 3rem;
      vertical-align: middle;
    }
  }
  ul {
    display: flex;
    margin: 15px 0;
    flex-wrap: wrap;
    user-select: none;
    @media screen and (max-width: 800px) {
      flex-direction: column;
      flex-wrap: nowrap;
      max-height: 300px;
      overflow-y: auto;
      border: $pencilbrdr;
      padding: 15px;
    }
    .addnew {
      @extend .base-button;
      text-decoration: none;
      background-color: #eee;
      color: $brand;
      display: block;
      width: 80%;
      margin: 0px auto;
      text-align: center;
      padding: 20px 10px;
      &:hover {
        color: white;
      }
    }
    li {
      border: 1px solid #ddd;
      margin: 5px;
      flex: 1;
      @media screen and (max-width: 800px) {
        display: block;
      }
      @media screen and (min-width: 800px) {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
      }
      @media screen and (min-width: 1090px) {
        max-width: 32%;
      }
      .info {
        padding: 20px;
      }
      h3 {
        font-family: $ltn;
        font-size: 1.3em;
        margin-bottom: 15px;
        text-transform: capitalize;
      }
      p {
        padding: 10px 0;
      }
      .ingredients {
        color: #aaa;
        font-size: 0.9rem;
      }
      .comments {
        font-size: 1.1rem;
      }
      .nutrients {
        @media screen and (min-width: 800px) {
          height: 40px;
        }
        display: flex;
        @media screen and (max-width: 500px) {
          flex-direction: column;
        }
        div {
          flex: 1;
          text-align: center;
          display: flex;
          align-items: center;
          justify-content: space-around;
          @media screen and (max-width: 500px) {
            justify-content: center;
          }
          padding: 5px;
          border-top: $pencilbrdr;
          font-size: 0.5rem;
          label {
            font-size: 0.5rem;
            text-transform: uppercase;
            color: #aaa;
            @media screen and (max-width: 500px) {
              margin-right: 5px;
            }
          }
        }
      }
      .time {
        background-color: $brand2;
        font-family: $bgr;
        letter-spacing: 1px;
        color: white;
        font-size: 0.8rem;
        display: inline-block;
        vertical-align: top;
        text-transform:uppercase;
        padding: 3px 5px;
        border-radius:10px;
        margin: 0 3px;
      }
    }
  }
}

/* ============= SET UP FOR TABS ============= */

.tabntr {
  display: flex;
  @media screen and (max-width: 1200px) {
    flex-direction: column;
  }
}

.tbbr {
  @extend .dash-container;
  flex: 3;
}

.tab-nav {
  margin: 0 0 15px 0;
  ul {
    display: flex;
    li {
      flex: 1;
      text-align: center;
      padding: 0 0 15px;
      border-bottom: 3px solid #ddd;
      cursor: pointer;
      font-family: $altg;
      font-size: 2em;
      img {
        max-height: 1.5em;
        vertical-align:middle;
        margin: 0 10px;
      }
    }
    li.actv {
      border-bottom: 3px solid $brand;
    }
  }
}

#tabcontent, #nutabcontent {
  max-height: 500px;
  min-height: 500px;
  overflow-x: auto;
  .tabcont, .nucontent {
    display: none;
  }
  .actv {
    display: block;
  }
}


/* ================== FOODSLIST STYLING ================ */

.btn-addmeal {
  display: block;
  margin: 10px auto;
  width: 50%;
  padding: 5px 10px;
  text-align: center;
  color: $brand;
  background-color: #eee;
  text-decoration: none;
  border-radius: 15px;
  cursor: pointer;
  transition: 0.2s all;
  &:hover {
    background-color: $brand;
    color: white;
    transition: 0.2s all;
  }
}


.foods, .archives {
  user-select: none;
  .btn {
    @extend .base-button;
    display: block;
    width: 50%;
    text-align: center;
    margin: 10px auto 20px;
    text-decoration: none;
    padding: 10px;
  }
  ul {
    font-size: 0.8em;
    li {
      display: flex;
      @media screen and (max-width: 800px) {
        flex-direction: column;
      }
      margin: 5px;
      border-top: $pencilbrdr;
      border-bottom: $pencilbrdr;
      border-right: $pencilbrdr;
      .foodsub {
        img {
          height: 75px;
          width: 85px;
          margin-left: -10px;
        }
        border-left: $pencilbrdr;
        display: flex;
        align-items:center;
        padding: 0 10px;
        label {
          display: block;
          font-size: 0.8em;
          color: #ccc;
          text-transform: uppercase;
          margin: 5px;
        }
        h2 {
          font-size: 1.3em;
          margin: 0 0 0 10px;
          text-transform: capitalize;
          font-family: $ltn;
        }
      }
    }
  }
}

.first {
  flex: 4;
}

.second, .third {
  flex: 2;
}

.fourth {
  flex: 1;
}

.fourth, .third {
  flex-direction: column;
  justify-content: center;
  align-items: flex-start !important;
}

.third {
  .warn, .good, .neutral {
    cursor: pointer;
    margin: 2px 0;
    position: relative;
    /* ========= TOOLTIPS */
    .tooltip {
      display: none;
      min-width: 60px;
      background-color: #555;
      color: #fff;
      text-align: center;
      padding: 5px 0;
      border-radius: 6px;
      position: absolute;
      z-index: 1;
      bottom: -25%;
      left: 20%;
      margin-left: 60px;
      opacity: 0;
      transition: opacity 1s;
      &:after {
        content: "";
        position: absolute;
        top: 50%;
        right: 100%;
        margin-top: -5px;
        border-width: 5px;
        border-style: solid;
        border-color: transparent #555 transparent transparent;
      }
    }
    &:hover .tooltip {
      display: block;
      opacity: 1;
    }
  }
}

#archive {
  img {
    display: none;
  }
  display:flex;
  flex-wrap:wrap;
  flex-direction: column;
  @media screen and (min-width: 1000px) {
    flex-direction: row;
  }
  li {
    @media screen and (min-width: 800px) {
      min-width: 48%;
    }
  }
  .fourth {
    display: none;
  }
}

/* ============ NUTRITION TRACKER STYLING =========== */
.nutritiontrack {
  @extend .dash-container;
  flex: 1;
}

#data-bar {
  width: 225px;
  height: 300px;
}

.nutritionintro {
  font-size: 1.1em;
  color: #ccc;
  font-style: italic;
  line-height: 1.3em;
  margin-bottom: 20px;
}

/* ======= ARCHIVE STYLING === */
.archives {
  @extend .dash-container;
  .title {
      flex: 1;
      text-align: center;
      padding: 0 0 15px;
      border-bottom: 3px solid #ddd;
      font-family: $altg;
      font-size: 2em;
      margin-bottom: 15px;
      img {
        max-height: 1.5em;
        vertical-align:middle;
        margin: 0 10px;
      }
  }
}

.meals {
  ul {
    display: flex;
    flex-wrap: wrap;
  }
  li {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    min-width: 300px;
    border: $pencilbrdr;
    padding: 10px;
    margin: 10px;
    .metadata {
      display: flex;
      align-items: center;
      justify-content: space-around;
      margin-bottom: 10px;
      h3 {
        font-family: $ltn;
        text-transform: capitalize;
        font-size: 1.2rem;
      }
      .iconclick {
        display: none;
      }
      .time {
        color: white;
        background-color: $brand2;
        letter-spacing: 1px;
        font-size: 0.8rem;
        padding: 3px 5px;
        border-radius:10px;
        margin: 0 3px;
        text-transform: uppercase;
      }
    }
    .nutrients {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
      font-size: 0.7rem;
      padding: 8px 0 0 0;
      border-top: $pencilbrdr;
      margin-top: 8px;
    }
    .ingredients {
      margin-bottom: 8px;
      color: #ccc;
      font-size: 0.8rem;
    }
  }
}

/*==== WARN GOOD NEUTRAL ===== */

.warn {
  color: $warn;
  border-bottom: 1px dotted $warn;
}
.good {
  color: $brand;
  border-bottom: 1px dotted $brand;
}
.neutral {
  color: $accent;
  border-bottom: 1px dotted $accent;
}
            
          
!
            
              
/* shoutout to http://callmenick.com/post/simple-responsive-tabs-javascript-css for the tutorial that lead me to this solution */

(() => {
  const tabs = (element, navClass, contClass) => {
    const theElement = document.getElementById(element);
    const tabNav = Array.from(theElement.getElementsByClassName(navClass));
    const tabCont = Array.from(theElement.getElementsByClassName(contClass));
    let activeIndex = 0;
    let initCalled = false;
    
    const init = () => {
      if (!initCalled) {
        initCalled = true;
        tabNav.forEach((nav) => {
          nav.addEventListener('click', (e) => {
            e.preventDefault();
            goToTab(tabNav.indexOf(nav));
          });
        });
      }
    };
    
    const goToTab = (index) => {
      if (index !== activeIndex && index >= 0 && index <= tabNav.length) {
        tabNav[activeIndex].classList.remove('actv');
        tabNav[index].classList.add('actv');
        tabCont[activeIndex].classList.remove('actv');
        tabCont[index].classList.add('actv');
        activeIndex = index;
      }
    };
    
    return {
      init,
      goToTab
    };
  };
  window.tabs = tabs;
})();

const dashTabs = tabs('tabs', 'tablink', 'tabcont');
dashTabs.init();

const nuTabs = tabs('nutabs', 'nulink', 'nucontent');
nuTabs.init();
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console