Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

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.

              <!DOCTYPE html>
<html lang="pt-BR">
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  <title>Calculadora para Aquários</title>

  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" />
  <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js"></script>
<body class="container py-4">
  <div class="jumbotron">
    <h1 class="display-4">Calculadora para Aquários</h1>
    <p class="lead">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sit amet dui ut leo imperdiet finibus. Aliquam sit amet hendrerit enim, id laoreet sem.
    <hr class="my-4" />
    <p class="mb-0">
      Clique <a href="/">aqui</a> para voltar ao fórum.

  <div class="card">
    <header class="card-header">Calculadora</header>
    <div class="card-body">
      <div id="app">
        <form v-show="!show" @submit.prevent="calc">
          <input type="number" v-model.number="length" placeholder="Comprimento do aquário (em centímetros)" class="form-control" />
          <input type="number" v-model.number="height" placeholder="Altura do aquário (em centímetros)" class="form-control mt-3" />
          <input type="number" v-model.number="width" placeholder="Largura do aquário (em centímetros)" class="form-control my-3" />
          <button type="submit" class="btn btn-primary">Calcular</button>

          <div class="alert alert-danger mt-3 mb-0" v-show="error">
            Erro: Você deve preencher todos os campos acima.
        <div v-show="show">
            <dd><samp>{{ volume }}</samp></dd>
            <dd><samp>{{ thermostat }}</samp></dd>
            <dt>Litros por hora:</dt>
            <dd><samp>{{ liters }}</samp></dd>
          <div class="alert alert-info mb-0">
            Clique <a @click.prevent="show = false" href="#" class="alert-link">aqui</a> para calcular novamente.

  <div class="card mt-3">
    <div class="card-body">
      Desenvolvido por <a href="https://lffg.github.io" target="_blank">Luiz Felipe F.</a>

    new Vue({
      el: '#app',
      data: {
        length: '',
        height: '',
        width: '',
        show: false,
        error: false
      methods: {
        calc: function () {
          if (this.length === '' || this.height === '' || this.width === '') {
            return this.error = true;

          this.error = false;
          this.show = true;
      computed: {
        volume: function () {
          return Math.round((this.length * this.height * this.width) / 1000);
        thermostat: function () {
          if (this.volume < 40) return 25;
          else if (this.volume >= 40 && this.volume < 90) return 50;
          else if (this.volume >= 90 && this.volume < 130) return 100;
          else if (this.volume >= 130 && this.volume < 190) return 150;
          else if (this.volume >= 190 && this.volume < 250) return 200;
          else if (this.volume >= 250 && this.volume < 280) return 250;
          else if (this.volume >= 280 && this.volume < 350) return 300;
          else return Math.round(300 * this.volume / 350) ;
        liters: function () {
          return Math.round(this.volume * 5);

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.