Build a landing page with Tailwind CSS in 5 minutes using Flowbite
Tags: showdev, tailwindcss, webdev, javascript
Published: 2022-06-22 15:13:53

Greetings to all developers!

I'm one of the founders and project maintainers of the [Flowbite Library](https://flowbite.com/docs/getting-started/introduction/), one of the most popular collection of UI components built on top of the Tailwind CSS framework.

Today I am happy to show you what we've been working on the past few months and I will also show you how you can create a simple landing page with the Flowbite Blocks system and Tailwind CSS.

Here's a screenshot of the landing page that we'll build:

[![Tailwind CSS Landing Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/icq25vf08i6iuas5gpob.png)](https://themesberg.github.io/tailwind-landing-page/)

You can also check out these helpful links for reference:

- [Github repository/source code](https://github.com/themesberg/tailwind-css-landing-page)
- [Landing page demo](https://themesberg.github.io/tailwind-landing-page/)

Let's get started then!

## Flowbite Blocks - Tailwind UI components

First of all, let me introduce you the system that you will work with in this tutorial.

Using the utility classes from Tailwind CSS and the interactive components from the core Flowbite Library we have built over 120+ website sections featuring hero sections, advanced headers (navigation), CTA sections, cookie consent modal, and many more!

[![Tailwind UI components - Flowbite Blocks](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zqpdsq5hy4ux74p08ime.png)](https://flowbite.com/blocks/)

Some of them are actually free to use under the MIT license while some other can be accessed via the [Flowbite Pro](https://flowbite.com/pro/) license.

Here's an overview of the block categories that are readily available:

- [Hero sections](https://flowbite.com/blocks/marketing/hero/) (14 components)
- [Feature sections](https://flowbite.com/blocks/marketing/feature/) (9 components)
- [Headers](https://flowbite.com/blocks/marketing/header/) (8 components)
- [CTA sections](https://flowbite.com/blocks/marketing/cta/) (8 components)
- [Pricing sections](https://flowbite.com/blocks/marketing/pricing/) (7 components)
- [Content sections](https://flowbite.com/blocks/marketing/content/) (7 components)
- [Footer sections](https://flowbite.com/blocks/marketing/footer/) (7 components)
- [Social proof](https://flowbite.com/blocks/marketing/social-proof/) (6 components)
- [Popups] (https://flowbite.com/blocks/marketing/pop-up/) (5 components)
- [Team sections](https://flowbite.com/blocks/marketing/team/) (5 components)
- [FAQ sections](https://flowbite.com/blocks/marketing/faq/) (5 components)
- [Testimonials](https://flowbite.com/blocks/marketing/testimonial/) (5 components)
- [Newsletter sections](https://flowbite.com/blocks/marketing/newsletter/) (5 components)
- [Banners](https://flowbite.com/blocks/marketing/banner/) (5 components)
- [Contact Forms](https://flowbite.com/blocks/marketing/contact/) (5 components)
- [Blog Sections](https://flowbite.com/blocks/marketing/blog/) (5 components)
- [Customer Logos](https://flowbite.com/blocks/marketing/customer-logos/) (4 components)
- [Cookie Consent](https://flowbite.com/blocks/marketing/cookie/) (3 components)
- [404 Pages](https://flowbite.com/blocks/marketing/404/) (3 components)
- [500 Pages](https://flowbite.com/blocks/marketing/500/) (3 components)
- [Maintenance Pages](https://flowbite.com/blocks/marketing/maintenance/) (3 components)

These website sections can be easily used to build landing pages and marketing oriented websites by copy-pasting the code using the Flowbite Blocks interface.

Let me show you show you can work build a landing page in just a few minutes!

## Building a landing page in Tailwind CSS

The first section that we need to use is a header component, so let's check out the [Tailwind CSS Header](https://flowbite.com/blocks/marketing/header/) component from Flowbite Blocks.

[![Tailwind CSS Header - Flowbite](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2dumv72ng380sjcfs8b.png)](https://flowbite.com/blocks/marketing/header/)

As you can see, there's a "Requires Flowbite" label just above this block which means that we need to install Flowbite via NPM to make sure that the hamburger toggle works on responsive view.

Follow this [quickstart guide](https://flowbite.com/docs/getting-started/quickstart/) from the Flowbite Library to install it on your project.

Install Flowbite as a dependency using NPM by running the following command:

```bash
npm i flowbite
```

Require Flowbite as a plugin inside the `tailwind.config.js` file:

```javascript
module.exports = {

    plugins: [
        require('flowbite/plugin')
    ]

}
```

Include the main JavaScript file to make interactive elements work:

```html
<script src="../path/to/flowbite/dist/flowbite.js"></script>
```

Make sure that you copy over the `tailwind.config.js` file generated by the block system so that the `primary` class will be available:

```
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ["index.html", "./node_modules/flowbite/**/*.js"],
  darkMode: 'class',
  theme: {
    extend: {
      colors: {
        primary: { "50": "#eff6ff", "100": "#dbeafe", "200": "#bfdbfe", "300": "#93c5fd", "400": "#60a5fa", "500": "#3b82f6", "600": "#2563eb", "700": "#1d4ed8", "800": "#1e40af", "900": "#1e3a8a" }
      }
    },
  },
  plugins: [
    require('flowbite/plugin')
  ],
}
```

Here's where you can get it:

![Tailwind CSS config file](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fs8eoztefo4iufcv3clw.png)

After you've pulled in the project, head back to the header block on Flowbite Blocks and click on the "Show code" button and then on the "Copy code" button on the right side to save it in your clipboard.

Now head over to your own project and copy-paste it just after the beginning of your `<body>` tag.

### Choosing a hero section

The next step we need to take is choose from one of the [Tailwind CSS Hero Sections](https://flowbite.com/blocks/marketing/hero/) from Flowbite.

I will choose the second one with the mobile mockup:

[![Tailwind CSS Hero - Flowbite](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ue7i8bfnqr5m0dwysq5t.png)](https://flowbite.com/blocks/marketing/hero/)

Let's add this right after the navigation bar inside your project.

### Customer logos

It's a good idea to also showcase the companies using your project so we're going to take at the [customer logos](https://flowbite.com/blocks/marketing/customer-logos/) blocks and choose the first one:

[![Tailwind CSS Logos - Flowbite](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tce7gvxw83iiw9xf9bqb.png)](https://flowbite.com/blocks/marketing/customer-logos/)

We can add this section right after the hero section.

### Choosing a feature section

A nice way to explain what your website is about can be done by choosing one of the [Tailwind CSS Feature Sections](https://flowbite.com/blocks/marketing/feature/) sections from Flowbite Blocks.

I like the first one because I can also use the icons as a visual description:

[![Tailwind CSS Feature - Flowbite](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q95f5282h3q84dih0x4r.png)](https://flowbite.com/blocks/marketing/feature/)

Let's add this after the customer logo section.

### Additional content

You should usually show at least 2-3 sections which explains what your website is about so choosing from the feature or content sections is advisable.

Let's take two [content sections](https://flowbite.com/blocks/marketing/content/) from Flowbite Blocks and add them right after the feature section:

[![Tailwind CSS Content - Flowbite](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9stvjpst7m5ztg7aklku.png)](https://flowbite.com/blocks/marketing/content/)

Let's take this one too where we can also add a link:

[![Tailwind CSS Content - Flowbite](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ds9mr33x43pkjl7d7lhi.png)](https://flowbite.com/blocks/marketing/content/)

We're almost ready! Next up we need to finish the page using a CTA (call to action) section to encourage the user to do something!

### CTA section

Luckily, there is a huge collection of [CTA sections coded with Tailwind CSS](https://flowbite.com/blocks/marketing/cta/) inside the Flowbite Blocks system.

Let's use this one which looks pretty good just before the footer:

[![Tailwind CSS CTA - Flowbite](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/41egblpehe394hel5xmn.png)](https://flowbite.com/blocks/marketing/cta/)

### Choosing a footer

Of course we also need to choose a footer that will be used to round up the landing page. The good news is that there are a lot of [Tailwind CSS Footer](https://flowbite.com/blocks/marketing/footer/) to choose from.

I really like the first one so let's choose this one:

[![Tailwind CSS Footer - Flowbite](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h84y5751s3echjw4qjnr.png)](https://flowbite.com/blocks/marketing/footer/)

Awesome! Let's take a look how this landing page looks:

[![Tailwind CSS Landing Page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/icq25vf08i6iuas5gpob.png)](https://themesberg.github.io/tailwind-landing-page/)

You can also check out these helpful links for reference:

- [Github repository/source code](https://github.com/themesberg/tailwind-css-landing-page)
- [Landing page demo](https://themesberg.github.io/tailwind-landing-page/)
- [Flowbite Blocks](https://flowbite.com/blocks/)
- [Flowbite Library](https://flowbite.com/docs/getting-started/introduction/)
- [Flowbite Figma](https://flowbite.com/figma/)
- [Tailwind CSS](https://tailwindcss.com/)

If you liked this tutorial make sure to give it a tweet or let me know the comments section what you think!