Sharing is free

Close astronaut | Feedback | Contact

HTML Boilerplates

Start your web project by generating and downloading your custom HTML Boilerplate.


1. Select what to include:

* You can also download a dist copy or a src copy to customize.

* Consult legal advice first."

2. Copy and paste the following code into your code editor to use:

                <!DOCTYPE html>
                <!--[if lte 8]><html class="pre-ie9" lang="en"><![endif]-->
                <!--[if gte IE 9]><!--><html lang="en"><!--<![endif]-->
                <html lang="">
                <html lang="">
                <head>
                  <meta charset="UTF-8" />
                  <title>Hello, world!</title>
                  <meta name="viewport" content="width=device-width,initial-scale=1" />
                  <meta name="description" content="" />
                  <link href="https://cdn.jsdelivr.net/npm/modern-normalize@
/modern-normalize.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@
/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
<script src="https://cdn.tailwindcss.com"></script> <link rel="stylesheet" type="text/css" href="style.css" /> <link rel="icon" href="favicon.png"> <link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png"> <link rel="apple-touch-icon" type="image/png" sizes="180x180" href="apple-touch-icon.png"> <link rel="icon" type="image/svg+xml" href="favicon.svg"> <meta name="theme-color" content="
">
<meta property="og:title" content="" /> <meta property="og:description" content="" /> <meta property="og:image" content="" /> <meta name="twitter:card" content="" /> <meta name="twitter:site" content="" /> <meta name="twitter:title" content="" /> <meta name="twitter:description" content="" /> <meta name="twitter:image" content="" /> <link rel="manifest" href="manifest.webmanifest"> <script async src='https://www.googletagmanager.com/gtag/js?id=
G-XXXXXXXXXX
'></script>
<script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '
G-XXXXXXXXXX
');
</script> </head> <body> <div id="fadein"></div> <div id="fadein" class="position-fixed top-0 start-0 w-100 h-100 bg-white" style="animation: fadeinall 1s normal 0.3s both;"></div> <style> /* For best practice, move CSS below to an external CSS file. */ @keyframes fadeinall { 0% { opacity: 1; } 97% { opacity: 0; } 98% { opacity: 0; -webkit-transform: translateY(0); transform: translateY(0); } 100% { opacity: 0; -webkit-transform: translateY(-100%); transform: translateY(-100%); z-index: -1; } } #fadein { opacity: 1; position: fixed; top: 0; left: 0; width: 100%; height: 100%; -webkit-transform: translateY(0); -ms-transform: translateY(0); transform: translateY(0); background-color: #FFFFFF; z-index: 999; -webkit-animation-fill-mode: forwards; animation-fill-mode: forwards; -webkit-animation: fadeinall 1s normal both; animation: fadeinall 1s normal both; -webkit-animation-delay: 0.3s; animation-delay: 0.3s; } </style> <div id="loader-wrapper"> <div class="loader"></div> </div> <style> /* For best practice, move CSS below to an external CSS file. */ @keyframes rotation { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } #loader-wrapper { background-color: #FFFFFF; position: fixed; top: 0; left: 0; z-index: 999; width: 100%; height: 100%; text-align: center; } .loader { width: 40px; height: 40px; border: 5px solid #000000; border-bottom-color: transparent; border-radius: 50%; margin-top:calc(50vh - 20px); display: inline-block; box-sizing: border-box; -webkit-animation: rotation 1s linear infinite; animation: rotation 1s linear infinite; } </style> <div id="loader-wrapper" class="bg-white position-fixed top-0 z-3 w-100 h-100 text-center"> <div class="spinner-border mt-5" role="status"> <span class="visually-hidden">Loading...</span> </div> </div> <header> <h1>Hello, world!</h1> </header> <nav></nav> <nav class="nav" id="nav"> <a href="#home">Logo</a> <a href="#menu-item-1">Menu Item 1</a> <a href="#menu-item-2">Menu Item 2</a> <a href="#menu-item-3">Menu Item 3</a> <a href="javascript:void(0);" id="menu-toggle" onclick="togglemenu()"> <div class="menu-toggle__bar1"></div> <div class="menu-toggle__bar2"></div> <div class="menu-toggle__bar3"></div> </a> </nav> <style> /* For best practice, move CSS below to an external CSS file. */ .nav { overflow: hidden; } .nav a { float: left; margin: 10px; display: block; } .nav #menu-toggle { display: none; } @media screen and (max-width: 600px) { .nav a:not(:first-child) { display: none; } .nav a#menu-toggle { float: right; display: block; } } @media screen and (max-width: 600px) { .nav.nav--open { position: relative; } .nav.nav--open #menu-toggle { position: absolute; right: 0; top: 0; } .nav.nav--open a { float: none; display: block; text-align: left; } } .menu-toggle__bar1, .menu-toggle__bar2, .menu-toggle__bar3 { width: 21px; height: 3px; background-color: #000000; margin: 4px 0; transition: 0.3s; } .menu-toggle--open .menu-toggle__bar1 { transform: translate(0, 7px) rotate(-45deg); } .menu-toggle--open .menu-toggle__bar2 { opacity: 0; } .menu-toggle--open .menu-toggle__bar3 { transform: translate(0, -7px) rotate(45deg); } </style> <nav class="navbar navbar-expand-lg bg-body-tertiary"> <div class="container-fluid"> <a class="navbar-brand" href="#">Navbar</a> <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse" id="navbarNavDropdown"> <ul class="navbar-nav"> <li class="nav-item"> <a class="nav-link active" aria-current="page" href="#">Home</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Features</a> </li> <li class="nav-item"> <a class="nav-link" href="#">Pricing</a> </li> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false"> Dropdown link </a> <ul class="dropdown-menu"> <li><a class="dropdown-item" href="#">Action</a></li> <li><a class="dropdown-item" href="#">Another action</a></li> <li><a class="dropdown-item" href="#">Something else here</a></li> </ul> </li> </ul> </div> </div> </nav> <h1>Hello, world!</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do. </p>
<img src="https://via.placeholder.com/
800
x
600
/" alt="">
<main> <section></section> <section></section> <section></section> </main> <form action="#"> <label for="firstName"
class="form-label"
>First name:</label><br>
<input type="text"
class="form-control"
name="firstName" value="John"><br>
<label for="lastName"
class="form-label"
>Last name:</label><br>
<input type="text"
class="form-control"
name="lastName" value="Doe"><br>
<label for="phone"
class="form-label"
>Phone:</label><br>
<input type="tel"
class="form-control"
name="phone" value="555-555-5555"><br>
<label for="company"
class="form-label"
>Company:</label><br>
<input type="text"
class="form-control"
name="company" value="XYZ Co."><br>
<label for="industry"
class="form-label"
>Industry:</label><br>
<select
class="form-select"
name="industry">
<option value="" selected disabled hidden>-- Select one --</option> <option value="industry 1">Industry 1</option> <option value="industry 2">Industry 2</option> <option value="industry 3">Industry 3</option> </select><br> <label for="message"
class="form-label"
>Message:</label><br>
<textarea
class="form-control"
name="message"></textarea><br>
<input type="submit"
class="btn btn-primary"
value="Submit">
</form> <style> /* For best practice, move CSS below to an external CSS file. */ .accordion { background-color: lightgray; color: #000000; cursor: pointer; padding: 18px; width: 100%; border: none; text-align: left; outline: none; font-size: 15px; transition: 0.4s; } .accordion-panel { padding: 0 18px; display: none; background-color: white; overflow: hidden; } .arrow-icon__line { width: 20px; height: 4px; background-color: #000000; } .accordion__indicator::after { content: "+"; } .accordion--open .accordion__indicator::after { content: "-"; } </style> <button class="accordion"> Accordion Section Heading 1<span class="accordion__indicator"></span> </button> <div class="accordion-panel"> <p>Accordion Section Content 1</p> </div> <button class="accordion"> Accordion Section Heading 2<span class="accordion__indicator"></span> </button> <div class="accordion-panel"> <p>Accordion Section Content 2</p> </div> <button class="accordion"> Accordion Section Heading 3<span class="accordion__indicator"></span> </button> <div class="accordion-panel"> <p>Accordion Section Content 3</p> </div> <div class="accordion" id="accordionExample"> <div class="accordion-item"> <h2 class="accordion-header" id="headingOne"> <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> Accordion Section Heading 1 </button> </h2> <div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample"> <div class="accordion-body"> Accordion Section Content 1 </div> </div> </div> <div class="accordion-item"> <h2 class="accordion-header" id="headingTwo"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> Accordion Section Heading 2 </button> </h2> <div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample"> <div class="accordion-body"> Accordion Section Content 2 </div> </div> </div> <div class="accordion-item"> <h2 class="accordion-header" id="headingThree"> <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> Accordion Section Heading 3 </button> </h2> <div id="collapseThree" class="accordion-collapse collapse" aria-labelledby="headingThree" data-bs-parent="#accordionExample"> <div class="accordion-body"> Accordion Section Content 3 </div> </div> </div> </div> <style> .splide__slide img { width: 100%; height: auto; } </style> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@splidejs/splide@
/dist/css/splide.min.css">
<section id="image-carousel" class="splide" aria-label="Images"> <div class="splide__track"> <ul class="splide__list"> <li class="splide__slide"> <img src="https://via.placeholder.com/800x600/000000" alt=""> <div> Description 01 </div> </li> <li class="splide__slide"> <img src="https://via.placeholder.com/800x600/333333" alt=""> <div> Description 02 </div> </li> <li class="splide__slide"> <img src="https://via.placeholder.com/800x600/666666" alt=""> <div> Description 03 </div> </li> </ul> </div> </div> <div id="carouselExampleCaptions" class="carousel slide"> <div class="carousel-indicators"> <button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button> <button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="1" aria-label="Slide 2"></button> <button type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide-to="2" aria-label="Slide 3"></button> </div> <div class="carousel-inner"> <div class="carousel-item active"> <img src="https://via.placeholder.com/1200x600/" class="d-block w-100" alt=""> <div class="carousel-caption d-none d-md-block"> <h5>First slide label</h5> <p>Some representative placeholder content for the first slide.</p> </div> </div> <div class="carousel-item"> <img src="https://via.placeholder.com/1200x600/" class="d-block w-100" alt=""> <div class="carousel-caption d-none d-md-block"> <h5>Second slide label</h5> <p>Some representative placeholder content for the second slide.</p> </div> </div> <div class="carousel-item"> <img src="https://via.placeholder.com/1200x600/" class="d-block w-100" alt=""> <div class="carousel-caption d-none d-md-block"> <h5>Third slide label</h5> <p>Some representative placeholder content for the third slide.</p> </div> </div> </div> <button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="visually-hidden">Previous</span> </button> <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleCaptions" data-bs-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="visually-hidden">Next</span> </button> </div>
<footer></footer> <div id="cookie-notice" style="width: 100%; position: fixed; z-index: 1000; bottom: 0; left: 0; background-color: lightgray;"> <p>This website uses cookies so that we can provide you with the best website experience. By clicking “I Accept” you acknowledge the use of cookies and to our <a href="#"><u>Privacy Policy</u></a>.</p> <a id="i-accept">I Accept</a> </div> <div id="cookie-notice" class="position-fixed bottom-0 w-100 p-2 text-bg-dark"> <p>This website uses cookies so that we can provide you with the best website experience. By clicking “I Accept” you acknowledge the use of cookies and to our <a href="#"><u>Privacy Policy</u></a>.</p> <button type="button" id="i-accept" class="btn btn-primary">I Accept</button> </div> <div style="width: 100%; position: fixed; z-index: 1000; top: 0; left: 0; background: lightgray;"><p>This is an announcemet.</p><div onClick="parentNode.remove()">Close [X]</div></div> <div class="position-fixed top-0 w-100 p-2 text-bg-dark d-flex justify-content-between"><p>This is an announcemet.</p><button type="button" class="btn-close btn-close-white" onClick="parentNode.remove()" aria-label="Close"></button></div> <!--[if IE]><div style="width: 100%; position: fixed; z-index: 1000; bottom: 0; left: 0; background: lightgray;"><p>Outdated browser dectected. Please use a modern browser for a better browsing experience.</p><div onClick="parentNode.remove()">Close [X]</div></div><![endif]--> <!--[if IE]><div class="position-fixed bottom-0 w-100 p-2 text-bg-dark d-flex justify-content-between"><p>Outdated browser dectected. Please use a modern browser for a better browsing experience.</p><button type="button" class="btn-close btn-close-white" onClick="parentNode.remove()" aria-label="Close"></button></div><![endif]--> <footer> <small>© <script>document.write(new Date().getFullYear())</script> Your company name. All Rights Reserved.</small> </footer> <!-- ░░░░░▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄░░░░░░░░ --> <!-- ░░░░░█░░░░▒▒▒▒▒▒▒▒▒▒▒▒░░▀▀▄░░░░ --> <!-- ░░░░█░░░▒▒▒▒▒▒░░░░░░░░▒▒▒░░█░░░ --> <!-- ░░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░░░█░░ --> <!-- ░▄▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░░░░█░ --> <!-- █░▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒▒▒▒░█ --> <!-- █░▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀▀▀▄▒█ --> <!-- ░█░▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░█░░█░ --> <!-- ░░█░░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀██░█░░ --> <!-- ░░░█░░░░██░░▀█▄▄▄█▄▄█▄████░█░░░ --> <!-- ░░░░█░░░░▀▀▄░█░░░█░█▀██████░█░░ --> <!-- ░░░░░▀▄░░░░░▀▀▄▄▄█▄█▄█▄█▄▀░░█░░ --> <!-- ░░░░░░░▀▄▄░▒▒▒▒░░░░░░░░░░▒░░░█░ --> <!-- ░░░░░░░░░░▀▀▄▄░▒▒▒▒▒▒▒▒▒▒░░░░█░ --> <!-- ░░░░░░░░░░░░░░▀▄▄▄▄▄░░░░░░░▄█░░ --> <script src="https://code.jquery.com/jquery-
.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@
/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@splidejs/splide@
/dist/js/splide.min.js"></script>
<script> new Splide( '.splide' ).mount(); </script> <script> function togglemenu() { var x = document.getElementById("nav"); if (x.className === "nav") { x.className += " nav--open"; } else { x.className = "nav"; } var element = document.getElementById("menu-toggle"); element.classList.toggle("menu-toggle--open"); } </script> <script type="text/javascript"> (function($){ $('#i-accept').on('click', function() { if(localStorage.hidecookiebar !== '1') { $('#cookie-notice').hide(); localStorage.hidecookiebar='1'; } }); if(localStorage.hidecookiebar == '1') { $('#cookie-notice').hide(); }; })(jQuery); </script> <script type="text/javascript"> window.onload = function(){ setTimeout(function(){ document.getElementById("fadein").remove(); },1000); }; </script> <script type="text/javascript"> $(window).on('load', function() { $("#loader-wrapper").fadeOut(700); }); </script> <script> var acc = document.getElementsByClassName("accordion"); var i; for (i = 0; i < acc.length; i++) { acc[i].addEventListener("click", function() { this.classList.toggle("accordion--open"); var panel = this.nextElementSibling; if (panel.style.display === "block") { panel.style.display = "none"; } else { panel.style.display = "block"; } }); } </script> <script src="app.js"></script> </body> </html>

Buy me a cup of coffee/beer/bubble tea?

HTML Boilerplate

A Developer's Guide to Building Consistent and Efficient Websites

Introduction

To build a house, you need tools ready no matter what you are building. It is the same with web development projects. Luckily, in a digital world we are blessed with the ability to copy and paste to make our groundwork easier. An HTML Boilerplate is a pre-prepared library of code that can be copied and is meant to be used as a starting point to start building web projects. It is sometimes referred to as an HTML starter template, HTML framework, HTML skeleton, or HTML foundation. Despite having "HTML" in its name, it is actually often a set of HTML, CSS, and JavaScript files that are designed to provide a solid foundation for websites.

What is HTML Boilerplate

An HTML Boilerplate includes a basic structure for an HTML document, like the typical html, head, and body tags, as well as links to CSS and JavaScript files. It may also include some basic CSS stylings, such as stylings to reset or normalize code which helps improve consistency between renderings in different browsers, and may include some basic JavaScript functionality, such as a responsive navigation menu or form validation.

As you may have noticed by now, it is important to customize your boilerplate prior to utilizing one, due to the unique requirements of each project and individual developer preferences. Some may prefer to include a normalize CSS file while others prefer to normalize as they go. That is why HTML Boilerplates provides ample customization options to accommodate these varying needs.

Why is an HTML Boilerplate needed in web development

The main use of an HTML Boilerplate is to make coding faster and easier for the developers to get a new web project up and running. This can save time and effort, as developers do not have to start from scratch and write the same code over and over again every time they begin a new project. Additionally, an HTML boilerplate can help to ensure that a website is built in a consistent and standardized way, which can make it easier for other developers who work on the same projects to understand and maintain in the future.

The components of HTML Boilerplate

HTML Boilerplate typically includes the following components:

  • HTML:

    The markup language used to structure the content of a website.
  • CSS:

    The language used for styling and layout of a website. This is optional.
  • JavaScript:

    A programming language used for adding interactivity and dynamic functionality to a website. This is also optional.

The HTML elements commonly found within an HTML boilerplate typically encompass:

  • <!DOCTYPE html>:

    This declaration defines the document type and version of HTML being used, in this case, HTML5.
  • <html lang="">:

    The <html> tag defines the root of an HTML document and contains all other HTML elements. We included lang in it as the lang attribute in the HTML tag is an important aspect of web accessibility and internationalization. The lang attribute specifies the language of the contents of a web page, which can help assistive technologies like screen readers understand and accurately read the text on the page. Additionally, the lang attribute can also impact search engine optimization (SEO) and the way text is rendered in different languages.
  • <head>:

    This tag contains information about the document, such as the title, metadata, and links to CSS and JavaScript files, that is not displayed in the main body of the web page.
  • <meta charset="UTF-8">:

    This tag defines the character encoding for the document, in this case, UTF-8. UTF-8 is a commonly adopted character encoding that supports a wide range of characters from different languages and scripts.
  • <meta name="viewport" content="width=device-width, initial-scale=1.0">:

    This tag sets the viewport, which is the area of the browser window used to display the web page. The value width=device-width sets the width to the width of the device and initial-scale=1 sets the initial zoom level to 100%.
  • <title>:

    This tag defines the title of the web page, which is displayed in the browser tab or title bar.
  • <body>:

    This tag contains the main content of the web page, such as headings, text, images, videos, links, and buttons.

Additionally, an HTML Boilerplate may also include other technologies. Below are some technologies you may consider to include to further increase the capability of an HTML boilerplate:

  • Normalize CSS:

    A small CSS file that makes browsers render all elements more consistently and in line with modern standards. It is a modern, HTML5-ready alternative to the traditional CSS reset. It preserves useful default styles rather than erasing them. It is widely used as a starting point for CSS normalization in web development projects, as it allows developers to maintain consistent cross-browser rendering while still having the ability to add custom styles as needed. The goal of Normalize.css is to make sure that all HTML elements have a consistent appearance across all browsers, eliminating the need to write browser-specific CSS styles.
  • Bootstrap:

    A popular open-source CSS framework designed for building responsive websites. Bootstrap provides a comprehensive set of pre-designed CSS styles, components, and JavaScript plugins that can be used to quickly and easily create a well-designed, professional-looking website. This saves developers time and effort in having to build and design components from scratch. Bootstrap is designed to be flexible and customizable, allowing developers to easily modify the framework to meet the specific needs of their projects.
  • jQuery:

    Despite its age, jQuery is still one of the most widely used JavaScript libraries among web client-side web development and has been in use for over a decade. Its popularity can be attributed to several factors, including its ease of use, compatibility with a wide range of browsers, and the availability of a large number of plugins and extensions. It provides a simple API for performing complex tasks in client-side web development and has become a staple in many web development projects.

How to create a boilerplate in HTML?

Open your code editor and start by constructing the fundamental HTML elements including the <!DOCTYPE html>, html, head, meta declarations, and body. Review your future web development projects and the intended use of your HTML boilerplate to determine which additional elements should be included to optimize its effectiveness. For a faster option, utilize the HTML Boilerplate generator above to easily customize the HTML tags and insert code snippets to give yourself a head start. What makes HTML Boilerplates unique is the code snippets you can generate to include in your HTML boilerplate.

Keeping HTML Boilerplates Free

No credit cards, no signups, no downloading zipped code and forgetting where you saved it. What's my trick to keep it profitable? Well, it's not. As a developer, HTML Boilerplates was built to supercharge my web development workflow and it ended up being a time-saver. However, a lot of hours are being spent to build the site and to keep it up-to-date. Please help me keep HTML Boilerplates free with a small donation.