DEV Community

Cover image for How to create a beautiful tab using bootstrap?
Noor Baloch
Noor Baloch

Posted on

How to create a beautiful tab using bootstrap?

Bootstrap provides a range of classes and styles that you can use to create beautiful and functional tabs on your web page. Contrast is also an essential aspect of creating a visually appealing design.

Here are the steps to create a beautiful tab using Bootstrap.

1- Add the necessary files: Add Bootstrap CSS and JS files, and jQuery to your web page.

`<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
Enter fullscreen mode Exit fullscreen mode

`
2- Create the HTML markup for the tab structure using the Bootstrap tab component. You can include as many tabs as you want, and you can also customize the appearance of each tab.

`

  <p>Tab 1 content goes here.</p>


  <p>Tab 2 content goes here.</p>


  <p>Tab 3 content goes here.</p>
Enter fullscreen mode Exit fullscreen mode

`
3- Add your custom styles to the tab component to enhance the appearance of the tab. Use contrast to create a visually appealing design. For example, you can use a light background color for the active tab and a darker color for the inactive tabs.

`
.nav-tabs .nav-link.active {
background-color: #f8f9fa;
border-color: #dee2e6 #dee2e6 #fff;
color: #495057;
}

.nav-tabs .nav-link {
border: 1px solid #dee2e6;
color: #495057;
}

.nav-tabs .nav-link:hover {
border-color: #e9ecef #e9ecef #dee2e6;
}

.tab-content {
background-color: #fff;
border: 1px solid #dee2e6;
border-top: none;
padding: 20px;
}

`
4- Save and test your web page to see the beautiful tab design.
By following these steps, you can create a beautiful tab using Bootstrap and contrast. You can further customize the design by using different colors, fonts, and other CSS styles.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more