Bootstrap snippet and html example. 2FA Security form

Bootstrap 5.0.1 snippet "2FA Security form" with HTML, CSS, and JS. Copy, paste, and customize this responsive UI component for your project.
Tags: password,security,2factor,2factor-authentication

HTML code

Clean, semantic HTML that powers this Bootstrap 5.0.1 snippet. Copy and paste it into your page (with Bootstrap loaded) to reproduce the exact layout shown in the preview.

<div class="container">
    <br>
    <div class="row">
        <div class="col-lg-5 col-md-7 mx-auto my-auto">
            <div class="card">
                <div class="card-body px-lg-5 py-lg-5 text-center">
                    <img src="https://bootdey.com/img/Content/avatar/avatar7.png" class="rounded-circle avatar-lg img-thumbnail mb-4" alt="profile-image">
                    <h2 class="text-info">2FA Security</h2>
                    <p class="mb-4">Enter 6-digits code from your athenticatior app.</p>
                    <form>
                        <div class="row mb-4">
                            <div class="col-lg-2 col-md-2 col-2 ps-0 ps-md-2">
                                <input type="text" class="form-control text-lg text-center" placeholder="_" aria-label="2fa">
                            </div>
                            <div class="col-lg-2 col-md-2 col-2 ps-0 ps-md-2">
                                <input type="text" class="form-control text-lg text-center" placeholder="_" aria-label="2fa">
                            </div>
                            <div class="col-lg-2 col-md-2 col-2 ps-0 ps-md-2">
                                <input type="text" class="form-control text-lg text-center" placeholder="_" aria-label="2fa">
                            </div>
                            <div class="col-lg-2 col-md-2 col-2 pe-0 pe-md-2">
                                <input type="text" class="form-control text-lg text-center" placeholder="_" aria-label="2fa">
                            </div>
                            <div class="col-lg-2 col-md-2 col-2 pe-0 pe-md-2">
                                <input type="text" class="form-control text-lg text-center" placeholder="_" aria-label="2fa">
                            </div>
                            <div class="col-lg-2 col-md-2 col-2 pe-0 pe-md-2">
                                <input type="text" class="form-control text-lg text-center" placeholder="_" aria-label="2fa">
                            </div>
                        </div>
                        <div class="text-center">
                            <button type="button" class="btn bg-info btn-lg my-4">Continue</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

CSS code

Scoped CSS that styles the component. Paste it after Bootstrap 5.0.1 to keep the design, spacing, and responsiveness consistent.

body{
    background:#eee;
}
.card {
    box-shadow: 0 20px 27px 0 rgb(0 0 0 / 5%);
}
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: #fff;
    background-clip: border-box;
    border: 0 solid rgba(0,0,0,.125);
    border-radius: 1rem;
}
.img-thumbnail {
    padding: .25rem;
    background-color: #ecf2f5;
    border: 1px solid #dee2e6;
    border-radius: .25rem;
    max-width: 100%;
    height: auto;
}
.avatar-lg {
    height: 150px;
    width: 150px;
}

Similar snippets

Bootstrap example and template. bs4 reset password page

bs4 reset password page

Bootstrap example and template. locked screen page

locked screen page

Bootstrap example and template. 2 step verification form inside a card

2 step verification form inside a card

Bootstrap example and template. profile security settings

profile security settings

Bootstrap example and template. Chat box

Chat box

Bootstrap example and template. Facebook Compose new post

Facebook Compose new post

Bootstrap example and template. blog page

blog page

Bootstrap example and template. table pageing

table pageing

FAQ

How do I use this snippet?

Include Bootstrap 5.0.1, paste the HTML, add the CSS block, and include the JS (if any) to mirror the live preview.

Can I use it in commercial projects?

Yes. It’s free for personal and commercial work; check the snippets license for details.

Is it responsive?

Yes. It inherits the responsive grid and components from Bootstrap 5.0.1.

Bootstrap example and template. 2FA Security form

About this bootstrap example/template

Optimized for copy‑paste: clean HTML, scoped CSS, and minimal JS so you can ship production‑ready UI faster and keep designs consistent.

Mobile‑first and responsive by default. Tested across modern browsers to reduce polish time on your project.

Already trusted in 17.4K+ views. Reuse this snippet to speed up landing pages, dashboards, or onboarding flows.

Bootstrap 5.0.1

<link rel='stylesheet' href='https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css'>

<script src='https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js'></script>

This code example is based on bootstrap 5.0.1 and the grid system of this framework

Responsive

Based on bootstrap framework makes all the layouts perfectly responsive for all devices

Crossbrowser compatibility

Tested on all major browsers, it works smoothly on all of them

semantic html 5

Built on html / css3 the code quality is really amazing

Simple Integration

This code example can be simply integrated on existing sites and new ones too, all you need to do is copy the code and start working