Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

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

Packages

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.

Behavior

Auto Save

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

              
                <!DOCTYPE html>
<html>
<head>
	<title>Generador de Banners para Canva</title>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
</head>
<body>
	<div class="container">
		<h1 class="my-4">Generador de Banners para Canva</h1>
		<div class="form-group">
			<label for="tamano">Seleccione el tamaño del banner:</label>
			<select id="tamano" class="form-control">
				<option value="300x250">Google ADS genérico 300x250</option>
				<option value="250x250">Google ADS genérico 250x250</option>
				<option value="200x200">Google ADS genérico 200x200</option>
        <option value="320x50">Google ADS Móvil 320x50</option>
				<option value="160x600">Google ADS Móvil 160x600</option>
				<option value="300x600">Google ADS Móvil 300x600</option>
				<option value="336x280">Google ADS Móvil 336x280</option>
				<option value="468x60">Google ADS Móvil 468x60</option>
				<option value="120x600">Google ADS Móvil 120x600</option>
        <option value="300x300">Google ADS Automático 300x300</option>
				<option value="600x314">Google ADS Automático 600x314</option>
			</select>
		</div>
		<div class="form-group">
			<label for="titulo">Introduzca el título del diseño:</label>
			<input type="text" id="titulo" class="form-control" placeholder="Introduzca el título aquí">
		</div>
		<button onclick="generarEnlace()" class="btn btn-primary">Generar enlace</button>
    <button onclick="generarTodosLosEnlaces()" class="btn btn-secondary">Generar todos los enlaces</button>
		<p id="resultado" class="mt-3"></p>
    <p id="resultado-todos" class="mt-3"></p>
	</div>

	<script>
		function generarEnlace() {
			var tamano = document.getElementById("tamano").value;
			var width = tamano.split("x")[0];
			var height = tamano.split("x")[1];
			var titulo = document.getElementById("titulo").value;
			var url = "https://www.canva.com/design?create&width=" + width + "&height=" + height + "&title=" + encodeURIComponent(titulo);

			document.getElementById("resultado").innerHTML = "<a href='" + url + "' target='_blank'>Enlace para el diseño</a>";
		}
    
    
    function generarTodosLosEnlaces() {
  var titulo = document.getElementById("titulo").value;
  var tamanoSelect = document.getElementById("tamano");
  var tamanoOptions = tamanoSelect.options;
  var urls = "";

  for (var i = 0; i < tamanoOptions.length; i++) {
    var tamano = tamanoOptions[i].value;
    var width = tamano.split("x")[0];
    var height = tamano.split("x")[1];
    var url = "https://www.canva.com/design?create&width=" + width + "&height=" + height + "&title=" + encodeURIComponent(titulo);
    urls += "<a href='" + url + "' target='_blank'>Enlace para " + tamano + "</a><br/>";
  }

  document.getElementById("resultado-todos").innerHTML = urls;
}
	</script>
</body>
</html>

              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console