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


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


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.


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.


                <!-- DOCTYPE html -->
<body id="bod">

<h3>Linear / Radial Gradient Color picker</h3>
Select your colors:
  <input type="color" id="myColor"> 
  <input type="color" id="myColor2">
   <a href="#" onclick="swapper()">
     ↔ Swap <small> 	&#x219D;   ( Click then hit submit )</small> </a> 
   <h3>Gradient Style</h3>
  <input type="radio" name="grad" value="linear" checked> Linear
   <input type="radio" name="degz" value="0deg" checked> 0 Deg,
   <input type="radio" name="degz" value="45deg"> 45 Deg,
   <input type="radio" name="degz" value="90deg"> 90 Deg,
   <input type="radio" name="degz" value="135deg"> 135 Deg,
   <input type="radio" name="degz" value="180deg"> 180 Deg.
  <input type="radio" name="grad" value="radial">
  Radial  	&#10687; ( degrees not allowed )
    <button type="submit">Submit</button>
  <p>Click the button .</p>
<p id="demo"></p>



{ min-height: 100vh;
    linear-gradient(#542, whitesmoke,goldenrod,#222); 
  background-repeat: no-repeat;
  color: white;
  text-shadow: 2px 2px 4px #000000;

{ color: white;
  text-shadow: 2px 2px 4px #000000;  


                var name = "";
var val = "linear";
var deg = "0deg,";
var gradi = "";
var swappy = false;

function myFunction() 
{   var x = document.getElementById("myColor").value;
    var y = document.getElementById("myColor2").value;    
   if( swappy == true)
   {  var x1 = x;
      var y1 = y;
      x = y1;
      y = x1;       
    var grad = gradi + "-gradient(" + deg  + x + " , " + y + " )";    
    document.getElementById("demo").innerHTML =  grad;
    document.getElementById("bod").style.background = grad;
 swappy = false;



var form = document.querySelector("form");
var log = document.querySelector("#log");

form.addEventListener("submit", function(event)
  var data = new FormData(form);  
  for (const entry of data)  // when submit is hit, all radio buttons report if checked
  { name = entry[0] ; // radio btn name
    val = entry[1] ; // radio btn value
    //console.log(name + " - " + val);
     if(name == "grad")
     { gradi = val;
     if( name == "degz")
     { deg = val + ",";        
    if (gradi == "radial"){deg = "";}
}, false);

function swapper()
{ swappy = true;