HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
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.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div id="id_check_request_page" style="width: 1000px; margin: 0px auto 0px auto;" class="clear">
<div class="floatleft" style="width: 998px;">
<p class="toolheading" style="margin-top: 10px;">
Random Password Generator
</p>
<p class="runningtxt">
Create a strong random password. Include numbers, alphabets(Lower case and upper case) and special characters to generate a strong password.
</p>
</div>
<div class="clear"></div>
<form name="passform" siq_id="autopick_1486">
<div>
<div class="floatleft">
<input type="text" class="websitename floatleft" style="padding-left: 8px;" name="password" size="30" id="password" value="Your password will be shown here">
</div>
<div class="copypass floatleft">
<span style="color: #1E90FF;" id="message"></span>
</div>
</div>
<div class="clear"></div>
<div id="configdiv" style="border:1px solid transparent;">
<div> </div>
<div>
<span class="toolstext">Password Rules</span>
</div>
<div class="labelname floatleft marright">
Password length
</div>
<div>
<input type="text" class="passlength" name="passwordLength" value="10" size="3">
</div>
<div class="clear"></div>
<div class="labelname floatleft marright">
<input type="checkbox" name="uppercase" checked=""> A-Z
</div>
<div class="labelname floatleft marright">
<input type="checkbox" class="passcheckbox" name="lowercase" checked=""> a-z
</div>
<div class="labelname floatleft marright">
<input type="checkbox" name="numbers" checked=""> 0-9
</div>
<div class="labelname">
<input type="checkbox" name="avoidAmbiguous" checked="">
Avoid Ambiguous Characters(1,I,l,o,O,0)
</div>
<div class="labelname marright">
<input type="checkbox" id="defaultspecialchars" name="specialchars">
Use Special Characters
</div>
</div>
<div>
<input class="grnbutton" type="button" value="Regenerate Password" onclick="generatePassword()">
</div>
</form>
</div>
.marright {
margin-right:16px;
}
.passcheckbox {
position : relative;
top : 0;
margin-top : 0;
}
.passradio {
position:relative;
top:0px;
margin-top:0px;
margin-right:5px
}
.passlength {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #fff;
border-color: #cccccc;
border-image: none;
border-style: solid solid solid solid;
border-width: 1px 1px 1px 1px;
color: #888;
font-family: 'Open Sans',sans-serif,helevetica;
font-size: 15px;
font-weight: 300;
height: auto;
margin:8px 0px 3px 0px;
text-align: center;
}
.websitename {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #fff;
border-color: #cccccc;
border-image: none;
border-style: solid solid solid solid;
border-width: 1px 1px 1px 1px;
color: #888;
float: left;
font-family: 'Open Sans',sans-serif,helevetica;
font-size: 18px;
font-weight: 300;
height: 52px;
margin-bottom: 6px;
margin-left: 0;
margin-top: 6px;
text-align: left;
width: 360px;
}
input.grnbutton {
background-color:#83b633;
color: #ffffff;
cursor: pointer;
font-family:'Open Sans', sans-serif,Helvetica;
font-size:17px;
font-weight: 500;
height: 53px;
line-height:28px;
text-align: center;
text-decoration: none;
width: auto;
letter-spacing:-0.5px;
border:0;
padding:10px;
margin-bottom:15px;
margin-top:10px;
}
.copypass {
padding:20px 15px;
}
.showopts {
width:360px;
text-align:right;
}
.labelname {
color: #484848;
font-family: 'open sans',sans-serif,Helvetica;
font-size: 14px;
line-height: 17px;
margin-bottom: 10px;
padding-top: 10px;
text-align: left;
font-weight:500;
letter-spacing:0.1px;
}
span.toolstext {
color: #484848;
font-family: 'open sans',sans-serif,Helvetica;
font-size: 17px;
line-height: 24px;
margin-bottom: 10px;
padding-top: 10px;
text-align: left;
font-weight:500;
letter-spacing:0.1px;
}
.clear {
clear: both;
}
.floatright {
float:right;
}
.floatleft {
float:left;
}
p.toolheading {
color: #555;
font-family: 'open sans',sans-serif,Helvetica;
font-size: 28px;
font-weight: 600;
letter-spacing: -1px;
line-height: 1em;
padding-top: 10px;
text-align: left;
}
.toolsrunningtxt {
color: #888;
font-size: 12px;
letter-spacing: 0.5px;
line-height: 18px;
padding: 15px 0 5px;
text-align: left;
}
function generatePassword()
{
var passInfo = passwordInfo();
var passLengthMax = 50;
passInfo.passLength = document.passform.passwordLength.value;
if(passInfo.passLength > passLengthMax)
{
showMsg("Please provide password length less than "+passLengthMax); // No I18N
return;
}
//passInfo.specialCharacters = document.passform.splcharstext.value;
passInfo.useNumbers = document.passform.numbers.checked;
passInfo.useLowerCaseAlphabets = document.passform.lowercase.checked;
passInfo.useUpperCaseAlphabets = document.passform.uppercase.checked;
//passInfo.useSpecialCharacters = document.passform.ownspecialchars.checked;
passInfo.useDefaultSpecialChars = document.passform.defaultspecialchars.checked;
passInfo.avoidAmbiguousChars = document.passform.avoidAmbiguous.checked;
var password = PasswordGenerator.generatePass(passInfo);
document.passform.password.value = password;
copyPassword(document.getElementById('password'));
}
var PasswordGeneratorConstants = {
LOWER_CASE : "abcdefghijklmnopqrstuvwxyz", // No I18N
UPPER_CASE : "ABCDEFGHIJKLMNOPQRSTUVWXYZ", // No I18N
NUMBERS : "0123456789",
LOWER_CASE_NON_AMBIGUOUS : "abcdefghijkmnpqrstuvwxyz", // No I18N
UPPER_CASE_NON_AMBIGUOUS : "ABCDEFGHJKLMNPQRSTUVWXYZ", // No I18N
NUMBERS_NON_AMBIGUOUS : "23456789",
DEFAULT_SPL_CHARS : "[email protected]#$%^&*()"
}
var passwordInfo = function PasswordInfo(){
this.passLength;
//this.specialCharacters;
this.useNumbers;
this.useLowerCaseAlphabets;
this.useUpperCaseAlphabets;
this.useDefaultSpecialChars;
//this.useSpecialCharacters;
this.avoidAmbiguousChars;
return this;
}
var PasswordGenerator ={};
PasswordGenerator.generatePass = function(passwordInfo){
var length = passwordInfo.passLength;
var charset = "";
var password = "";
if(passwordInfo.avoidAmbiguousChars)
{
if(passwordInfo.useNumbers)
{
password += PasswordGeneratorConstants.NUMBERS_NON_AMBIGUOUS.charAt(Math.round(Math.random() * (PasswordGeneratorConstants.NUMBERS_NON_AMBIGUOUS.length-1)));
length -= 1;
charset = charset+PasswordGeneratorConstants.NUMBERS_NON_AMBIGUOUS;
}
if(passwordInfo.useLowerCaseAlphabets)
{
password += PasswordGeneratorConstants.LOWER_CASE_NON_AMBIGUOUS.charAt(Math.round(Math.random() * (PasswordGeneratorConstants.LOWER_CASE_NON_AMBIGUOUS.length-1)));
length -= 1;
charset = charset+PasswordGeneratorConstants.LOWER_CASE_NON_AMBIGUOUS;
}
if(passwordInfo.useUpperCaseAlphabets)
{
password += PasswordGeneratorConstants.UPPER_CASE_NON_AMBIGUOUS.charAt(Math.round(Math.random() * (PasswordGeneratorConstants.UPPER_CASE_NON_AMBIGUOUS.length-1)));
length -= 1;
charset = charset+PasswordGeneratorConstants.UPPER_CASE_NON_AMBIGUOUS;
}
}
else
{
if(passwordInfo.useNumbers)
{
password += PasswordGeneratorConstants.NUMBERS.charAt(Math.round(Math.random() * (PasswordGeneratorConstants.NUMBERS.length-1)));
length -= 1;
charset = charset+PasswordGeneratorConstants.NUMBERS;
}
if(passwordInfo.useLowerCaseAlphabets)
{
password += PasswordGeneratorConstants.LOWER_CASE.charAt(Math.round(Math.random() * (PasswordGeneratorConstants.LOWER_CASE.length-1)));
length -= 1;
charset = charset+PasswordGeneratorConstants.LOWER_CASE;
}
if(passwordInfo.useUpperCaseAlphabets)
{
password += PasswordGeneratorConstants.UPPER_CASE.charAt(Math.round(Math.random() * (PasswordGeneratorConstants.UPPER_CASE.length-1)));
length -= 1;
charset = charset+PasswordGeneratorConstants.UPPER_CASE;
}
}
/*if(passwordInfo.useSpecialCharacters && document.passform.splcharstext.value != "")
{
password += passwordInfo.specialCharacters.charAt(Math.round(Math.random() * (passwordInfo.specialCharacters.length-1)));
length -= 1;
charset = charset+passwordInfo.specialCharacters;
}
else */
if(passwordInfo.useDefaultSpecialChars)
{
password += PasswordGeneratorConstants.DEFAULT_SPL_CHARS.charAt(Math.round(Math.random() * (PasswordGeneratorConstants.DEFAULT_SPL_CHARS.length-1)));
length -= 1;
charset = charset+PasswordGeneratorConstants.DEFAULT_SPL_CHARS;
}
//Shuffling the charset
var shuffledCharSet = "";
var stringLength = charset.length;
for(var i=0; i < stringLength;i++)
{
var randomNumber = Math.round(Math.random() * (charset.length-1));
if(randomNumber == charset.length-1)
{
shuffledCharSet += charset.charAt(randomNumber);
charset = charset.slice(0, randomNumber)
}
else
{
shuffledCharSet += charset.charAt(randomNumber);
charset = charset.slice(0, randomNumber) + charset.slice(randomNumber+1);
}
}
//picking the remaining characters for password
for (var i = 0, n = shuffledCharSet.length; i < length; ++i)
{
var randomNumber = Math.round(Math.random() * (n-1));
password += shuffledCharSet.charAt(randomNumber);
}
//shuffling the final password
var shuffledPass = "";
var passLength = password.length;
for(var i=0; i < passLength;i++)
{
var randomNumber = Math.round(Math.random() * (password.length-1));
if(randomNumber == password.length-1)
{
shuffledPass += password.charAt(randomNumber);
password = password.slice(0, randomNumber)
}
else
{
shuffledPass += password.charAt(randomNumber);
password = password.slice(0, randomNumber) + password.slice(randomNumber+1);
}
}
return shuffledPass;
}
function copyPassword(passElement)
{
var selectionStart, selectionEnd;
target = passElement;
selectionStart = passElement.selectionStart;
selectionEnd = passElement.selectionEnd;
var currentFocus = document.activeElement;
target.focus();
target.setSelectionRange(0, target.value.length);
var success;
try
{
success = document.execCommand("copy");
}
catch(e)
{
success = false;
}
if (currentFocus && typeof currentFocus.focus === "function") {
currentFocus.focus();
}
passElement.setSelectionRange(selectionStart, selectionEnd);
var message = "";
if (!success)
{
message = "Copy is not supported by the browser"
}
else
{
message = "Copied the password successfully!"
}
showMsg(message);
}
function showMsg(message)
{
document.getElementById("message").innerHTML = message;
setTimeout(function() {
document.getElementById("message").innerHTML = "";
}, 3000);
}
Also see: Tab Triggers