CSS Tabs – Border around Content, but not on bottom of the active tab

I have the code below and it’s working good so far.
My Problem is, that I want a border around the content, but not on the bottom of the active tab. So I can’t easily make a border around the content, because disabling on the bottom of the active tab have no effect. If I make the border left, right and bottom of the content, I have no border on the top of the content.

The HTML:

<div id="containerUser">
    <div class="tabsUser">
        <input type="radio" name="tabsUser" id="tabOne" checked="checked">
        <label for="tabOne">
            <i class="bi bi-eye-fill"></i> <span>Overview</span></label>
        <div class="userContent">
            Content Tab 1
        </div>

        <input type="radio" name="tabsUser" id="tabTwo">
        <label for="tabTwo">
            <i class="bi bi-key-fill"></i> <span>Access</span></label>
        <div class="userContent">
            Content Tab 2
        </div>
    </div>
</div>

The CSS:

#containerUser {
    margin-right: 10px;
}

#containerUser .userContent {
    padding-left: 10px;
    padding-bottom: 10px;
    padding-right: 10px;
}

#containerUser .tabsUser {
    width: 100%;
    display: flex;
    flex-wrap: wrap; /* Make sure it wraps */
}

#containerUser .tabsUser label {
    order: 1;
    display: block;
    padding: 5px 20px;
    margin-right: 5px;
    cursor: pointer;
    background: #f5f5f5;
    font-size: 12px;
    font-weight: bold;
    transition: background ease 0.2s;
    width: 150px;
    text-align: center;
    border-radius: 10px 10px 0px 0px;
    border-left: 1px solid rgba(0, 0, 0, 0.3);
    border-right: 1px solid rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(0, 0, 0, 0.3);
}

#containerUser .tabsUser .userContent {
    order: 99;
    flex-grow: 1;
    width: 100%;
    height: 300px;
    display: none;
    padding: 1rem;
    background: #fff;
}

This is, how it looks now.

This is, how it should look.

1

You’re just not thinking third-dimensionally! Web pages have three dimensions, and in this case you need to utilise the third dimension, the z-axis. Elements can be placed in specific layers relative to other elements, and elements in front will mask elements behind.

Start by setting different coloured borders on your tabs and your content area:

Then use relative positioning to move your tabs down by the width of your border, so that they overlap the border of the content area. We could at this point specify a z-index as well to make it clear that we want the tab labels to appear in front of the content area, but it’s not necessary to do so in this case. (Read more about stacking contexts here.)

#containerUser .tabsUser label {
  position: relative;
  top: 1px;
}

Then simply set the bottom border width of the active tab to zero.

#containerUser .tabsUser input:checked + label {
  border-bottom: 0;
}

Here is a snippet to demonstrate the finished result.

#containerUser {
    margin-right: 10px;
}

#containerUser .userContent {
    padding-left: 10px;
    padding-bottom: 10px;
    padding-right: 10px;
}

#containerUser .tabsUser {
    width: 100%;
    display: flex;
    flex-wrap: wrap; /* Make sure it wraps */
}

#containerUser .tabsUser input {
  visibility: hidden;
}

#containerUser .tabsUser label {
    order: 1;
    display: block;
    padding: 5px 20px;
    margin-right: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: background ease 0.2s;
    width: 150px;
    text-align: center;
    border-radius: 10px 10px 0px 0px;
    border: 1px solid #bbb;
    position: relative;
    top: 1px;
    color: #aaa;
}

#containerUser .tabsUser label:hover {
    color: orange;
}

#containerUser .tabsUser .userContent {
    order: 99;
    flex-grow: 1;
    width: 100%;
    height: 100px;
    padding: 1rem;
    background: #f5f5f5;
    border: 1px solid #bbb;
    border-radius: 10px;
    display: none;
}

#containerUser .tabsUser input:checked + label {
    border-bottom: 0;
    color: black;
    background: #f5f5f5;
}

#containerUser .tabsUser input:checked + label + .userContent {
  display: block;
}
<div id="containerUser">
    <div class="tabsUser">
        <input type="radio" name="tabsUser" id="tabOne" checked="checked">
        <label for="tabOne">
            <i class="bi bi-eye-fill"></i> <span>Overview</span></label>
        <div class="userContent">
            Content Tab 1
        </div>

        <input type="radio" name="tabsUser" id="tabTwo">
        <label for="tabTwo">
            <i class="bi bi-key-fill"></i> <span>Access</span></label>
        <div class="userContent">
            Content Tab 2
        </div>
    </div>
</div>

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật