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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <span class="input">
  Celcius: <input id="celInput"> </input>
<br>
  Fahrenheit: <input id="fahInput"> </input>
<br>
<button class="calc" onClick="calculate()"> Calculate </button>
</span>
<span class="thermometer">
  <span class="C"></span>
  <span class="F"></span>
</span>
              
            
!

CSS

              
                html{
    background:radial-gradient(circle, #fcee92 0%,#ebcf12 50%);
}

/* Thermometer column and text */
.thermometer{
    margin:50px auto;
    width:22px;
    height:150px;
    display:block;
    font:bold 14px/152px helvetica, arial, sans-serif;
    text-indent: 36px;
    background: linear-gradient(top, #fff 0%, #fff 50%, #db3f02 50%, #db3f02 100%);
    border-radius:22px 22px 0 0;
    border:5px solid #4a1c03;
    border-bottom:none;
    position:relative;
    box-shadow:inset 0 0 0 4px #fff;
    color:#4a1c03;
}

/* Thermometer Bulb */
.thermometer:before{
    content:' ';
    width:44px;
    height:44px;
    display:block;
    position:absolute;
    top:142px;
    left:-16px;
    z-index:-1; /* Place the bulb under the column */
    background:#db3f02;
    border-radius:44px;
    border:5px solid #4a1c03;
    box-shadow:inset 0 0 0 4px #fff;
}

/* This piece here connects the column with the bulb */
.thermometer:after{
    content:' ';
    width:14px;
    height:150px;
    display:block;
    position:absolute;
    top:30px;
    left:4px;
    background:#db3f02;
}
              
            
!

JS

              
                // For this project, you will complete the code for a JavaScript program to 
// convert temperatures to and from Celsius, Fahrenheit.
/*
  You will add lines of code within the function to make it run:
  you will add the code to convert celcius values to fahrenheit values.
  you will add the code to convert fahrenheit values to celcius values.
  Then, test your program by entering a value for the Celsius or Fahrenheit 
  inputs on the page,
  and checking the outcomes 
  Do not enter values for both Celsius and Fahrenheit
*/
let cDegree = "&deg;C";
let fDegree = "&deg;F";
let inputC = document.querySelector(".C");
let inputF = document.querySelector(".F");

function calculate(){
  let celInput = document.getElementById("celInput").value;
  let fahInput = document.getElementById("fahInput").value;
  if((celInput != null) && (fahInput == "")){
    Celsius = parseInt(celInput.toString());
    // On this line, declare a new variable named convertedFahrenheit.

    // set convertedFahrenheit -> Use your knowledge of operators and the formula (formula ---> use your research skills to find a formula) to convert celcius to fahrenheit. Store the converted temperature value in this variable. Use Celcius...Celcius has already been stored in a variable. 
    
    // On this line, reassign the variable fahrenheit to be equivalent to the value of the convertedFahrenheit variable

   
    doMathFirst();
  }
  else if((celInput == "") && (fahInput != null)){
    Fahrenheit = parseInt(fahInput.toString());
    // On this line, declare a new variable named convertedCelsius. 

    // set convertedCelsius -> Use your knowledge of operators and the formula (forumula ---> use your research skills to find a formula) to convert fahrenheit to celcius. Store the converted temperature value in this variable. Use Fahrenheit in your formula...Fahrenheit has already been stored in a variable.
    
    // On this line, reassign the variable Celsius to be equivalent to the value of the convertedCelsius variable

    doMathFirst();
  }
  else{
    console.log("You can't put two values in at once. Remove one.");
  }
}

function doMathFirst(){
  inputC.innerHTML=Celsius+cDegree;
  inputF.innerHTML=Fahrenheit+fDegree;
}

              
            
!
999px

Console