How to prevent these table cells from expanding with Tailwind CSS?

When the browser shrinks horizontally, the table cells fit their content as desired. However, when the browser expands horizontally, the table cells expands too. How to prevent this with Tailwind CSS? In other words, how to make the table cells fit their content regardless of the browser’s width?

<div class="overflow-x-auto">
  <div class="relative w-full overflow-auto">
    <table class="caption-bottom text-sm w-full">
      <thead class="bg-subtle [&_tr]:border-b">
        <tr class="hover:bg-muted/10 data-[state=selected]:bg-muted border-b transition-colors">
          <th class="h-12 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 cursor-pointer false">
            <div class="flex items-center"><span>Name</span></div>
          </th>
          <th class="h-12 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 cursor-pointer false">
            <div class="flex items-center"><span>Alternative name</span></div>
          </th>
          <th class="h-12 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 cursor-pointer false">
            <div class="flex items-center"><span>Mobile phone</span></div>
          </th>
          <th class="h-12 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 cursor-pointer false">
            <div class="flex items-center"><span>Email</span></div>
          </th>
          <th class="h-12 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 cursor-pointer false">
            <div class="flex items-center"><span>Country</span></div>
          </th>
          <th class="h-12 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 cursor-pointer false">
            <div class="flex items-center"><span>Address</span></div>
          </th>
          <th class="h-12 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 cursor-default">
            <div class="flex items-center"><span></span></div>
          </th>
        </tr>
      </thead>
      <tbody class="[&_tr:last-child]:border-0">
        <tr class="hover:bg-muted/10 data-[state=selected]:bg-muted border-b transition-colors group cursor-pointer">
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">
              <div class="flex w-full items-center gap-2 justify-start">
                <div class="relative flex shrink-0 h-8 w-8">
                  <div class="flex w-full items-center justify-center overflow-hidden rounded-full border"><img src="https://placehold.co/32?text=G&font=Raleway"></div>
                  <div class="absolute bottom-0 right-0 rounded-full border-2 border-white h-2 w-2 bg-muted"></div>
                </div>Graiden Abbott1
              </div>
            </div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">Benedict Blankenship</div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">+1 (699) 124-4483</div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap"><a href="mailto:[email protected]">[email protected]</a></div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">Albania</div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">Excepteur voluptates</div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">
              <div class="opacity-0 transition-all group-hover:opacity-100"><button class="inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 text-foreground underline-offset-4 hover:opacity-90" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-star h-5 w-5 text-muted">
                    <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
                  </svg></button></div>
            </div>
          </td>
        </tr>
        <tr class="hover:bg-muted/10 data-[state=selected]:bg-muted border-b transition-colors group cursor-pointer">
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">
              <div class="flex w-full items-center gap-2 justify-start">
                <div class="relative flex shrink-0 h-8 w-8">
                  <div class="flex w-full items-center justify-center overflow-hidden rounded-full border"><img src="https://placehold.co/32?text=B&font=Raleway"></div>
                  <div class="absolute bottom-0 right-0 rounded-full border-2 border-white h-2 w-2 bg-muted"></div>
                </div>Brynne Wall
              </div>
            </div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">Rebekah Manning</div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">+1 (468) 738-9949</div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap"><a href="mailto:[email protected]">[email protected]</a></div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">Andorra</div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">Quam expedita laudan</div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">
              <div class="opacity-0 transition-all group-hover:opacity-100"><button class="inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 text-foreground underline-offset-4 hover:opacity-90" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-star h-5 w-5 text-muted">
                    <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
                  </svg></button></div>
            </div>
          </td>
        </tr>
        <tr class="hover:bg-muted/10 data-[state=selected]:bg-muted border-b transition-colors group cursor-pointer">
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">
              <div class="flex w-full items-center gap-2 justify-start">
                <div class="relative flex shrink-0 h-8 w-8">
                  <div class="flex w-full items-center justify-center overflow-hidden rounded-full border"><img src="https://placehold.co/32?text=S&font=Raleway"></div>
                  <div class="absolute bottom-0 right-0 rounded-full border-2 border-white h-2 w-2 bg-muted"></div>
                </div>Stone Guthrie
              </div>
            </div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">Hayfa Justice</div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">+1 (443) 847-4221</div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap"><a href="mailto:[email protected]">[email protected]</a></div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">Algeria</div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">Maxime qui rerum eu </div>
          </td>
          <td class="p-2 align-middle [&:has([role=checkbox])]:pr-0">
            <div class="inline-block whitespace-nowrap">
              <div class="opacity-0 transition-all group-hover:opacity-100"><button class="inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 text-foreground underline-offset-4 hover:opacity-90" type="button"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-star h-5 w-5 text-muted">
                    <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon>
                  </svg></button></div>
            </div>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</div>

Live code at Tailwind Playground

1

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