Add borders around Bootstrap tabs


Becca

I'm using Bootstrap tab markup like this:

.nav-tabs {

    &.nav-tabs-alt {
        padding-top: 30px;

        li {
            a {
                color: @brand-info;
                font-size: 16px;
            }
        }

        li.active {

            a {
                background-color: #fff;
                color: @brand-primary !important;
                font-size: 16px;
            }
        }
    }
}

.tab-content {
    &.tab-content-alt {

    }
}
<!DOCTYPE html>
<html lang="">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Title Page</title>
  <!-- Bootstrap CSS -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>

<body>
    <div>

        <!-- Nav tabs -->
        <ul class="nav nav-tabs nav-tabs-alt" role="tablist">
            <li role="presentation" class="active"><a href="#call" aria-controls="home" role="tab" data-toggle="tab">Call Us</a></li>
            <li role="presentation"><a href="#email" aria-controls="profile" role="tab" data-toggle="tab">Email Us</a></li>
        </ul>

        <!-- Tab panes -->
        <div class="tab-content tab-content-alt">
            <div role="tabpanel" class="tab-pane fade in active" id="call">...</div>
            <div role="tabpanel" class="tab-pane fade" id="email">...</div>
        </div>

    </div>

  <script src="http://code.jquery.com/jquery.js"></script>
  <!-- Bootstrap JavaScript -->
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>

</body>

</html>

However, I want to do this if the border surrounds the entire tab, as shown below, but in my example the border is not smooth and there are breakpoints. Any ideas how to achieve this result?

.nav-tabs {

    &.nav-tabs-alt {
        padding-top: 30px;

        li {
            a {
                color: @brand-info;
                font-size: 16px;
            }
        }

        li.active {

            a {
                background-color: #fff;
                color: @brand-primary !important;
                font-size: 16px;
            }
        }
    }
}

.tab-content.tab-content-alt {
        border-right: 1px solid #ddd;
        border-left: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
        border-top-color:transparent;
        border-radius: 4px;
    }
}
<!DOCTYPE html>
<html lang="">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Title Page</title>
  <!-- Bootstrap CSS -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>

<body>
    <div>

                    <!-- Nav tabs -->
                    <ul class="nav nav-tabs nav-tabs-alt" role="tablist">
                        <li role="presentation" class="active"><a href="#call" aria-controls="home" role="tab" data-toggle="tab">Call Us</a></li>
                        <li role="presentation"><a href="#email" aria-controls="profile" role="tab" data-toggle="tab">Email Us</a></li>
                    </ul>

                    <!-- Tab panes -->
                    <div class="tab-content tab-content-alt">
                        <div role="tabpanel" class="tab-pane fade in active" id="call">...</div>
                        <div role="tabpanel" class="tab-pane fade" id="email">...</div>
                    </div>

                </div>

  <script src="http://code.jquery.com/jquery.js"></script>
  <!-- Bootstrap JavaScript -->
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>

</body>

</html>

Emmanuel Lopez

I'm not sure I know, I just changed the border radius to zero, which created the effect of the fluid container

.nav-tabs {

    &.nav-tabs-alt {
        padding-top: 30px;

        li {
            a {
                color: @brand-info;
                font-size: 16px;
            }
        }

        li.active {

            a {
                background-color: #fff;
                color: @brand-primary !important;
                font-size: 16px;
            }
        }
    }
}

.tab-content.tab-content-alt {
        border-right: 1px solid #ddd;
        border-left: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
        border-top-color:transparent;
        border-radius: 0px;
    }
}
<!DOCTYPE html>
<html lang="">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Title Page</title>
  <!-- Bootstrap CSS -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>

<body>
    <div>

                    <!-- Nav tabs -->
                    <ul class="nav nav-tabs nav-tabs-alt" role="tablist">
                        <li role="presentation" class="active"><a href="#call" aria-controls="home" role="tab" data-toggle="tab">Call Us</a></li>
                        <li role="presentation"><a href="#email" aria-controls="profile" role="tab" data-toggle="tab">Email Us</a></li>
                    </ul>

                    <!-- Tab panes -->
                    <div class="tab-content tab-content-alt">
                        <div role="tabpanel" class="tab-pane fade in active" id="call">...</div>
                        <div role="tabpanel" class="tab-pane fade" id="email">...</div>
                    </div>

                </div>

  <script src="http://code.jquery.com/jquery.js"></script>
  <!-- Bootstrap JavaScript -->
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>

</body>

</html>

Related


Bootstrap tabs with custom borders

Andre Andrade I am using the wizard where the title is as shown in the image below. I'm using the Bootstrap-4 tab component and the :after pseudo-element method on the li element, but I don't know how to get the two-color background. desired result HTML snippe

Bootstrap tabs with custom borders

Andre Andrade I am using the wizard where the title is as shown in the image below. I'm using the Bootstrap-4 tab component and the :after pseudo-element method on the li element, but I don't know how to get the two-color background. desired result HTML snippe

Bootstrap tabs with custom borders

Andre Andrade I am using the wizard where the title is as shown in the image below. I'm using the Bootstrap-4 tab component and the :after pseudo-element method on the li element, but I don't know how to get the two-color background. desired result HTML snippe

Bootstrap tabs with custom borders

Andre Andrade I am using the wizard where the title is as shown in the image below. I'm using the Bootstrap-4 tab component and the :after pseudo-element method on the li element, but I don't know how to get the two-color background. desired result HTML snippe

Add consistent 1px borders around bootstrap columns

David Is there a clean, css-only way to add a consistent 1px border around the cols where you don't have a 2px border when the two are side by side? Notice how the outer edge has a 1px border and the inner border is double width because they are side by side.

Add borders around headings and paragraphs

ninja I am trying to put a border around headings and paragraphs. Currently, I have two separate borders around headings and paragraphs. How can I put a border around them? <style type="text/css"> h1{ font-family: consolas; border: 2px solid #73AD21; border-r

Add borders around headings and paragraphs

ninja I am trying to put a border around headings and paragraphs. Currently, I have two separate borders around headings and paragraphs. How can I put a border around them? <style type="text/css"> h1{ font-family: consolas; border: 2px solid #73AD21; border-r

Native base tabs - any ideas how to remove borders around tabs?

Yossi The screenshot below is the result of the code provided below. Any idea how to remove the border around the tabs? import React from 'react'; import { SafeAreaView } from 'react-native'; import { Container, Header, Title, Text, Tabs, Tab } from 'native-ba

Native base tabs - any ideas how to remove borders around tabs?

Yossi The screenshot below is the result of the code provided below. Any idea how to remove the border around the tabs? import React from 'react'; import { SafeAreaView } from 'react-native'; import { Container, Header, Title, Text, Tabs, Tab } from 'native-ba

How to add borders around states in leaflet map

yohir islam I'm using this example of a map of the US, and I http://leafletjs.com/examples/choropleth.html.'m using a color to highlight a map of a state. But the problem is that some markers were clickable before adding this highlight color now becomes unclic

How to add borders around states in leaflet map

yohir islam I'm using this example of a map of the US, and I http://leafletjs.com/examples/choropleth.html.'m using a color to highlight a map of a state. But the problem is that some markers were clickable before adding this highlight color now becomes unclic

How to add transparent borders around grid rows?

object oriented Inside the grid there is a grid. The inner grid is required to have a transparent border in order to show the background color of the outer grid. So far: <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Rectangle Fil

How to add borders around states in leaflet map

yohir islam I'm using this example of a map of the US, and I http://leafletjs.com/examples/choropleth.html.'m using a color to highlight a map of a state. But the problem is that some markers were clickable before adding this highlight color now becomes unclic

How to add borders around states in leaflet map

yohir islam I'm using this example of a map of the US, and I http://leafletjs.com/examples/choropleth.html.'m using a color to highlight a map of a state. But the problem is that some markers were clickable before adding this highlight color now becomes unclic

How to add transparent borders around grid rows?

object oriented Inside the grid there is a grid. The inner grid is required to have a transparent border in order to show the background color of the outer grid. So far: <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Rectangle Fil

Add responsive borders to Bootstrap carousel

Wired marker I'm having a hard time implementing responsive borders on a carousel made with bootstrap . My situation is simple. I don't want a full-width carousel ; my images are 940px wide and must be the maximum size of the width. Of course, the turntable mu

How can I add borders around the entire DataGrid column headers?

Shahin Dohan I've customized DataGridquite a few things, but surprisingly I can't add a border around the entire header area without breaking it. This is what I'm trying to accomplish: The following controls are responsible for displaying the title area: DataG

Add Bootstrap panels with borders and centered text

myTest532 myTest532 I'm trying to create two panels in bootstrap with centralized text and different fonts in the text. like the picture below my code: <div class="row"> <div class="col-lg-6"> <div class="panel panel-default text-center">

Add Bootstrap panels with borders and centered text

myTest532 myTest532 I'm trying to create two panels in bootstrap with centralized text and different fonts in the text. like the picture below my code: <div class="row"> <div class="col-lg-6"> <div class="panel panel-default text-center">

Add Bootstrap panels with borders and centered text

myTest532 myTest532 I'm trying to create two panels in bootstrap with centralized text and different fonts in the text. like the picture below my code: <div class="row"> <div class="col-lg-6"> <div class="panel panel-default text-center">