Pen Settings



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


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.


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.


                <body class="container-fluid bg-body-tertiary d-block">
    <div class="row justify-content-center">
        <div class="row justify-content-center">
            <div class="col-12 col-md-6 col-lg-4" style="min-width: 500px;">
                <div class="card bg-white mb-5 mt-5 border-0" style="box-shadow: 0 12px 15px rgba(0, 0, 0, 0.02);">
                    <div class="card-body p-5">
                        <label for="password-input" class="form-label fw-bold">Password</label>
                        <input type="password" class="form-control" id="password-input" autocomplete="off"
                               aria-label="Password" aria-describedby="passwordHelp">
                        <div class="password-meter">
                            <div class="meter-section rounded me-2"></div>
                            <div class="meter-section rounded me-2"></div>
                            <div class="meter-section rounded me-2"></div>
                            <div class="meter-section rounded"></div>
                        <div id="passwordHelp" class="form-text text-muted">Use 8 or more characters with a mix of
                            letters, numbers &


                .password-meter {
    display: flex;
    height: 5px;
    margin-top: 10px;

.meter-section {
    flex: 1;
    background-color: #ddd;

.weak {
    background-color: #ff4d4d;

.medium {
    background-color: #ffd633;

.strong {
    background-color: #00b300;

.very-strong {
    background-color: #009900;


                const passwordInput = document.getElementById('password-input');
const meterSections = document.querySelectorAll('.meter-section');

passwordInput.addEventListener('input', updateMeter);

function updateMeter() {
    const password = passwordInput.value;
    let strength = calculatePasswordStrength(password);

    // Remove all strength classes
    meterSections.forEach((section) => {
        section.classList.remove('weak', 'medium', 'strong', 'very-strong');

    // Add the appropriate strength class based on the strength value
    if (strength >= 1) {
    if (strength >= 2) {
    if (strength >= 3) {
    if (strength >= 4) {

function calculatePasswordStrength(password) {
    const lengthWeight = 0.2;
    const uppercaseWeight = 0.5;
    const lowercaseWeight = 0.5;
    const numberWeight = 0.7;
    const symbolWeight = 1;

    let strength = 0;

    // Calculate the strength based on the password length
    strength += password.length * lengthWeight;

    // Calculate the strength based on uppercase letters
    if (/[A-Z]/.test(password)) {
        strength += uppercaseWeight;

    // Calculate the strength based on lowercase letters
    if (/[a-z]/.test(password)) {
        strength += lowercaseWeight;

    // Calculate the strength based on numbers
    if (/\d/.test(password)) {
        strength += numberWeight;

    // Calculate the strength based on symbols
    if (/[^A-Za-z0-9]/.test(password)) {
        strength += symbolWeight;

    return strength;