Tailwind CSS Border Spacing
The border spacing property in CSS specifies the distance between the borders of adjacent table cells with separated borders. While traditionally tied to tables, you can creatively use this property for specific layout needs in modern UI design. Tailwind CSS offers an array of utility classes that make implementing border spacing straightforward and scalable. These utilities ensure developers enjoy a fluid, mobile-first design system without worrying about writing custom CSS.
In this guide, we'll dive into the different ways to leverage Tailwind utilities to manipulate border spacing effectively—covering everything from basic setups to custom configurations, while always staying production-ready.
Overview of Border Spacing
Adding the Border Spacing
Tailwind provides utilities for defining the spacing between adjacent borders in tabular layouts. These utilities translate directly to border-spacing
properties in CSS, enabling you to manage horizontal and vertical spacing easily in separated borders.
// Importing TailwindCSS & rendering export default function BorderSpacingDemo() { return ( <div className="h-screen w-screen flex items-center justify-center bg-blue-50"> <table className="border-spacing-5 border-separate border border-gray-300"> <thead> <tr> <th className="border border-gray-400 p-4">Image</th> <th className="border border-gray-400 p-4">Description</th> </tr> </thead> <tbody> <tr> <td className="border border-gray-400"> <img src="https://images.unsplash.com/photo-1523275335684-37898b6baf30" alt="Decorative" className="h-32 w-32" /> </td> <td className="border border-gray-400 p-4">A stunning aesthetic.</td> </tr> </tbody> </table> </div> ); } // CSS Output // Applies: border-spacing: 5px;
States and Responsiveness
Hover and Focus States
Transitioning border spacing on user interactions like hovering or focusing enhances interactivity. Tailwind facilitates dynamic behavior through *state-based modifiers that adapt your elements based on the user's actions.
export default function HoverFocusBorderSpacing() { return ( <div className="h-screen w-screen flex items-center justify-center bg-gray-200"> <table className="hover:border-spacing-4 transition-all border-separate border border-gray-300"> <thead> <tr> <th className="border border-gray-400 p-4">Hover me</th> <th className="border border-gray-400 p-4">Focus Required</th> </tr> </thead> <tbody> <tr> <td className="border border-gray-500"> <img src="https://images.unsplash.com/photo-1523275335684-37898b6baf30" alt="Interactive example" className="h-28 w-28" /> </td> <td className="p-4 border border-gray-500">Try interacting</td> </tr> </tbody> </table> </div> ); } // CSS Output: // hover:border-spacing: 4px;
Breakpoint Modifiers
Tailwind's breakpoint system lets you apply different border-spacing
values depending on the device's screen size. By chaining responsive modifiers, you ensure consistent layouts across various viewports.
export default function ResponsiveBorderSpacing() { return ( <div className="h-screen w-screen flex items-center justify-center bg-white"> <table className="border border-separate sm:border-spacing-4 lg:border-spacing-12 border-gray-300"> <thead> <tr> <th className="border border-gray-400 p-4 text-sm"> Small Devices </th> <th className="border border-gray-400 p-4 text-sm"> Large Devices </th> </tr> </thead> <tbody> <tr className="sm:border-spacing-6 lg:border-spacing-10 border-spacing-2 transition-all"> <td className="border border-gray-500 p-2">Compact Value</td> <td className="border border-gray-500 p-2">Expansive Value</td> </tr> </tbody> </table> </div> ); }
Custom Border Spacing
Extending the Theme
In some projects, predefined utilities might not offer enough flexibility for your design requirements. Tailwind lets you define custom spacing values in your configuration file (tailwind.config.js
).
import tailwindConfig from "./tailwind.config.js"; tailwind.config = tailwindConfig; export default function CustomSpacing() { return ( <div className="h-screen w-screen flex items-center justify-center bg-indigo-50"> <table className="border-spacing-18 border-separate border border-gray-300 transition-all"> <thead> <tr> <th className="border border-gray-400 p-4">Custom Value</th> <th className="border border-gray-400 p-4">4.5rem</th> </tr> </thead> </table> </div> ); } // CSS Output: // border-spacing: 4.5rem;
Using Arbitrary Values
When dealing with non-standard measurements, you can apply arbitrary values directly for quick experimentation. Arbitrary values support any border-spacing
length, breaking outside the constraints of Tailwind's existing hierarchy.
export default function ArbitraryBorderSpacing() { return ( <div className="h-screen w-screen flex items-center justify-center bg-yellow-50"> <table className="border-spacing-[20px] border-separate border border-gray-300"> <thead> <tr> <th className="border border-gray-400 p-4">Arbitrary</th> <th className="border border-gray-400 p-4">20px</th> </tr> </thead> <tbody> <tr> <td className="border border-gray-500 p-2">Dynamic Control</td> <td className="border border-gray-500 p-2">Precise Layout</td> </tr> </tbody> </table> </div> ); } // CSS Output: // border-spacing: 20px;
Real World Examples
Product Comparison Grid
This example shows a product comparison table with border spacing to create clear visual separation between cells.
export default function LaptopComparisonTable() { const laptops = [ { name: "UltraBook Pro", price: "$1299", processor: "Intel i7 12th Gen", ram: "16GB", storage: "512GB SSD", src: "https://images.unsplash.com/photo-1531297484001-80022131f5a1", alt: "Silver UltraBook Pro laptop" }, { name: "MacBook Air", price: "$999", processor: "M2 Chip", ram: "8GB", storage: "256GB SSD", src: "https://images.unsplash.com/photo-1517336714731-489689fd1ca8", alt: "Space Gray MacBook Air" }, { name: "Gaming Beast X", price: "$1899", processor: "AMD Ryzen 9", ram: "32GB", storage: "1TB SSD", src: "https://images.unsplash.com/photo-1525547719571-a2d4ac8945e2", alt: "RGB Gaming Beast X laptop" }, { name: "ThinkPad Elite", price: "$1499", processor: "Intel i9 12th Gen", ram: "16GB", storage: "512GB SSD", src: "https://images.unsplash.com/photo-1544731612-de7f96afe55f", alt: "Black ThinkPad Elite laptop" }, { name: "Creator Pro", price: "$2099", processor: "Intel i9 13th Gen", ram: "64GB", storage: "2TB SSD", src: "https://images.unsplash.com/photo-1541807084-5c52b6b3adef", alt: "Silver Creator Pro laptop" }, { name: "Budget Master", price: "$699", processor: "AMD Ryzen 5", ram: "8GB", storage: "256GB SSD", src: "https://images.unsplash.com/photo-1588872657578-7efd1f1555ed", alt: "Gray Budget Master laptop" } ]; return ( <div className="overflow-x-auto"> <table className="border-separate border-spacing-4"> <thead> <tr> <th className="font-bold text-lg">Model</th> <th className="font-bold text-lg">Image</th> <th className="font-bold text-lg">Price</th> <th className="font-bold text-lg">Processor</th> <th className="font-bold text-lg">RAM</th> <th className="font-bold text-lg">Storage</th> </tr> </thead> <tbody> {laptops.map((laptop) => ( <tr key={laptop.name} className="hover:bg-gray-50"> <td className="font-medium">{laptop.name}</td> <td> <img src={laptop.src} alt={laptop.alt} className="w-32 h-24 object-cover rounded" /> </td> <td>{laptop.price}</td> <td>{laptop.processor}</td> <td>{laptop.ram}</td> <td>{laptop.storage}</td> </tr> ))} </tbody> </table> </div> ); }
Compact Restaurant Menu Grid
A dense menu layout with minimal border spacing for efficient space usage while maintaining readability.
export default function RestaurantMenu() { const menuItems = [ { name: "Garden Fresh Salad", price: "$12", category: "Starters", description: "Mixed greens, cherry tomatoes, cucumber", src: "https://images.unsplash.com/photo-1512621776951-a57141f2eefd", alt: "Fresh garden salad" }, { name: "Grilled Salmon", price: "$28", category: "Mains", description: "Atlantic salmon with lemon butter", src: "https://images.unsplash.com/photo-1467003909585-2f8a72700288", alt: "Grilled salmon dish" }, { name: "Truffle Pasta", price: "$24", category: "Mains", description: "Handmade pasta with black truffle", src: "https://images.unsplash.com/photo-1473093226795-af9932fe5856", alt: "Truffle pasta plate" }, { name: "Chocolate Lava Cake", price: "$10", category: "Desserts", description: "Warm chocolate cake with vanilla ice cream", src: "https://images.unsplash.com/photo-1541783245831-57d6fb0926d3", alt: "Chocolate lava cake" }, { name: "Prime Ribeye", price: "$42", category: "Mains", description: "12oz aged beef with garlic butter", src: "https://images.unsplash.com/photo-1558030006-450675393462", alt: "Prime ribeye steak" }, ]; return ( <div className="max-w-4xl mx-auto p-4"> <table className="border-separate border-spacing-1 w-full"> <thead className="bg-amber-50"> <tr> <th className="p-2">Dish</th> <th className="p-2">Image</th> <th className="p-2">Category</th> <th className="p-2">Description</th> <th className="p-2">Price</th> </tr> </thead> <tbody> {menuItems.map((item) => ( <tr key={item.name} className="hover:bg-amber-50 transition-colors"> <td className="p-2 font-medium">{item.name}</td> <td className="p-2"> <img src={item.src} alt={item.alt} className="w-24 h-24 object-cover rounded-full" /> </td> <td className="p-2 text-gray-600">{item.category}</td> <td className="p-2 text-sm">{item.description}</td> <td className="p-2 font-semibold">{item.price}</td> </tr> ))} </tbody> </table> </div> ); }
Event Schedule Timeline
A timeline-style table with generous border spacing to highlight important events.
export default function EventSchedule() { const events = [ { time: "09:00 AM", title: "Opening Keynote", speaker: "Dr. Sarah Chen", location: "Main Hall", duration: "1 hour", type: "Keynote", src: "https://images.unsplash.com/photo-1475721027785-f74eccf877e2", alt: "Opening keynote speaker" }, { time: "10:30 AM", title: "Future of AI Panel", speaker: "Multiple Speakers", location: "Room A", duration: "1.5 hours", type: "Panel", src: "https://images.unsplash.com/photo-1591115765373-5207764f72e7", alt: "AI Panel discussion" }, { time: "12:00 PM", title: "Networking Lunch", speaker: "All Attendees", location: "Garden Area", duration: "1 hour", type: "Break", src: "https://images.unsplash.com/photo-1511795409834-ef04bbd61622", alt: "Networking lunch" }, { time: "01:30 PM", title: "Workshop: Cloud Computing", speaker: "Mark Johnson", location: "Lab B", duration: "2 hours", type: "Workshop", src: "https://images.unsplash.com/photo-1451187580459-43490279c0fa", alt: "Cloud computing workshop" }, { time: "03:45 PM", title: "Startup Pitches", speaker: "Various Founders", location: "Auditorium", duration: "1.5 hours", type: "Competition", src: "https://images.unsplash.com/photo-1542744095-291d1f67b221", alt: "Startup pitch session" }, { time: "05:30 PM", title: "Closing Remarks", speaker: "Event Director", location: "Main Hall", duration: "30 mins", type: "Closing", src: "https://images.unsplash.com/photo-1515187029135-18ee286d815b", alt: "Closing ceremony" } ]; return ( <div className="max-w-5xl mx-auto p-6"> <table className="border-separate border-spacing-y-6 border-spacing-x-4 w-full"> <thead> <tr className="bg-indigo-50"> <th className="text-left p-4 rounded-l-lg">Time</th> <th className="text-left p-4">Event</th> <th className="text-left p-4">Speaker</th> <th className="text-left p-4">Image</th> <th className="text-left p-4">Location</th> <th className="text-left p-4 rounded-r-lg">Duration</th> </tr> </thead> <tbody> {events.map((event) => ( <tr key={event.title} className="bg-white shadow-sm hover:shadow-md transition-shadow"> <td className="p-4 font-mono rounded-l-lg">{event.time}</td> <td className="p-4 font-medium">{event.title}</td> <td className="p-4">{event.speaker}</td> <td className="p-4"> <img src={event.src} alt={event.alt} className="w-20 h-20 object-cover rounded" /> </td> <td className="p-4 text-gray-600">{event.location}</td> <td className="p-4 rounded-r-lg">{event.duration}</td> </tr> ))} </tbody> </table> </div> ); }
Team Member Directory
A responsive team directory with medium border spacing for balanced information density.
export default function TeamDirectory() { const team = [ { name: "Alexandra Smith", role: "CEO", department: "Executive", email: "alex@company.com", location: "New York", src: "https://images.unsplash.com/photo-1494790108377-be9c29b29330", alt: "Alexandra Smith headshot" }, { name: "Michael Chang", role: "Lead Developer", department: "Engineering", email: "michael@company.com", location: "San Francisco", src: "https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d", alt: "Michael Chang headshot" }, { name: "Emily Rodriguez", role: "Design Director", department: "Design", email: "emily@company.com", location: "London", src: "https://images.unsplash.com/photo-1438761681033-6461ffad8d80", alt: "Emily Rodriguez headshot" }, { name: "James Wilson", role: "Sales Manager", department: "Sales", email: "james@company.com", location: "Chicago", src: "https://images.unsplash.com/photo-1500648767791-00dcc994a43e", alt: "James Wilson headshot" }, { name: "Sarah Park", role: "Product Manager", department: "Product", email: "sarah@company.com", location: "Seoul", src: "https://images.unsplash.com/photo-1534528741775-53994a69daeb", alt: "Sarah Park headshot" }, { name: "David Chen", role: "Marketing Lead", department: "Marketing", email: "david@company.com", location: "Singapore", src: "https://images.unsplash.com/photo-1519345182560-3f2917c472ef", alt: "David Chen headshot" } ]; return ( <div className="max-w-6xl mx-auto p-8"> <table className="border-separate border-spacing-3 w-full bg-gray-50 rounded-xl"> <thead> <tr> <th className="p-3">Photo</th> <th className="p-3 text-left">Name</th> <th className="p-3 text-left">Role</th> <th className="p-3 text-left">Department</th> <th className="p-3 text-left">Location</th> <th className="p-3 text-left">Contact</th> </tr> </thead> <tbody> {team.map((member) => ( <tr key={member.email} className="bg-white rounded-lg"> <td className="p-3"> <img src={member.src} alt={member.alt} className="w-16 h-16 rounded-full object-cover" /> </td> <td className="p-3 font-medium">{member.name}</td> <td className="p-3 text-gray-600">{member.role}</td> <td className="p-3">{member.department}</td> <td className="p-3">{member.location}</td> <td className="p-3"> <a href={`mailto:${member.email}`} className="text-blue-600 hover:underline"> {member.email} </a> </td> </tr> ))} </tbody> </table> </div> ); }
Project Status Dashboard
A color-coded project tracking table with strategic border spacing for clear status visualization.
export default function ProjectDashboard() { const projects = [ { name: "Website Redesign", status: "In Progress", completion: "65%", priority: "High", deadline: "2024-02-28", team: "Design Squad", src: "https://images.unsplash.com/photo-1460925895917-afdab827c52f", alt: "Website redesign project thumbnail" }, { name: "Mobile App Development", status: "On Hold", completion: "30%", priority: "Medium", deadline: "2024-04-15", team: "Tech Tigers", src: "https://images.unsplash.com/photo-1551650975-87deedd944c3", alt: "Mobile app development thumbnail" }, { name: "Data Migration", status: "Completed", completion: "100%", priority: "High", deadline: "2024-01-31", team: "Data Team", src: "https://images.unsplash.com/photo-1551288049-bebda4e38f71", alt: "Data migration project thumbnail" }, { name: "Security Audit", status: "Not Started", completion: "0%", priority: "Critical", deadline: "2024-03-10", team: "Security Force", src: "https://images.unsplash.com/photo-1563986768609-322da13575f3", alt: "Security audit project thumbnail" }, { name: "Customer Portal", status: "In Progress", completion: "45%", priority: "High", deadline: "2024-05-20", team: "Portal Pioneers", src: "https://images.unsplash.com/photo-1557804506-669a67965ba0", alt: "Customer portal project thumbnail" }, { name: "AI Integration", status: "Planning", completion: "15%", priority: "Medium", deadline: "2024-06-30", team: "AI Avengers", src: "https://images.unsplash.com/photo-1677442136019-21780ecad995", alt: "AI integration project thumbnail" } ]; const getStatusColor = (status) => { const colors = { "Completed": "bg-green-100 text-green-800", "In Progress": "bg-blue-100 text-blue-800", "On Hold": "bg-yellow-100 text-yellow-800", "Not Started": "bg-gray-100 text-gray-800", "Planning": "bg-purple-100 text-purple-800" }; return colors[status] || "bg-gray-100 text-gray-800"; }; const getPriorityColor = (priority) => { const colors = { "Critical": "bg-red-100 text-red-800", "High": "bg-orange-100 text-orange-800", "Medium": "bg-yellow-100 text-yellow-800", "Low": "bg-green-100 text-green-800" }; return colors[priority] || "bg-gray-100 text-gray-800"; }; return ( <div className="max-w-7xl mx-auto p-6"> <table className="border-separate border-spacing-y-4 border-spacing-x-2 w-full"> <thead> <tr className="bg-gray-50"> <th className="p-4 text-left">Project</th> <th className="p-4 text-left">Preview</th> <th className="p-4 text-left">Status</th> <th className="p-4 text-left">Progress</th> <th className="p-4 text-left">Priority</th> <th className="p-4 text-left">Team</th> <th className="p-4 text-left">Deadline</th> </tr> </thead> <tbody> {projects.map((project) => ( <tr key={project.name} className="bg-white shadow-sm hover:shadow-md transition-shadow"> <td className="p-4 font-medium">{project.name}</td> <td className="p-4"> <img src={project.src} alt={project.alt} className="w-24 h-16 object-cover rounded" /> </td> <td className="p-4"> <span className={`px-3 py-1 rounded-full text-sm ${getStatusColor(project.status)}`}> {project.status} </span> </td> <td className="p-4"> <div className="w-full bg-gray-200 rounded-full h-2"> <div className="bg-blue-600 h-2 rounded-full" style={{ width: project.completion }} ></div> </div> <span className="text-sm text-gray-600 mt-1">{project.completion}</span> </td> <td className="p-4"> <span className={`px-3 py-1 rounded-full text-sm ${getPriorityColor(project.priority)}`}> {project.priority} </span> </td> <td className="p-4 text-gray-600">{project.team}</td> <td className="p-4 font-mono text-sm">{project.deadline}</td> </tr> ))} </tbody> </table> </div> ); }
Customization Examples
Calendar Events
Uses a moderate 0.7rem
spacing for balanced event information.
import tailwindConfig from "./tailwind.config.js"; tailwind.config = tailwindConfig; // App.js export default function CalendarEvents() { return ( <div class="p-8"> <h3 class="text-xl font-bold mb-4">Upcoming Events Calendar</h3> <p class="mb-4">A balanced calendar layout with moderate spacing for event scheduling</p> <table class="border-separate border-spacing-calendar bg-white shadow-md rounded-lg overflow-hidden"> <thead class="bg-teal-600 text-white"> <tr> <th class="p-3 text-left font-semibold">Date</th> <th class="p-3 text-left font-semibold">Event</th> <th class="p-3 text-left font-semibold">Time</th> <th class="p-3 text-left font-semibold">Location</th> </tr> </thead> <tbody> <tr> <td class="p-3 font-medium">Jan 15</td> <td class="p-3">Team Meeting</td> <td class="p-3">09:00 AM</td> <td class="p-3">Conference Room A</td> </tr> <tr class="bg-teal-50"> <td class="p-3 font-medium">Jan 16</td> <td class="p-3">Client Presentation</td> <td class="p-3">02:00 PM</td> <td class="p-3">Virtual</td> </tr> <tr> <td class="p-3 font-medium">Jan 17</td> <td class="p-3">Workshop</td> <td class="p-3">10:30 AM</td> <td class="p-3">Training Room</td> </tr> <tr class="bg-teal-50"> <td class="p-3 font-medium">Jan 18</td> <td class="p-3">Product Launch</td> <td class="p-3">11:00 AM</td> <td class="p-3">Main Hall</td> </tr> </tbody> </table> </div> ); }
Pricing Comparison
Uses a larger 1.3rem
spacing for better readability of pricing plans.
import tailwindConfig from "./tailwind.config.js"; tailwind.config = tailwindConfig; // App.js export default function CalendarView() { return ( <div class="p-8"> <h3 class="text-xl font-bold mb-4">Pricing Comparison</h3> <p class="mb-4">A spacious pricing table with clear separation between elements</p> <table class="border-separate border-spacing-pricing bg-white shadow-lg rounded-xl overflow-hidden"> <thead class="bg-indigo-600 text-white"> <tr> <th class="p-4 text-left font-semibold">Plan</th> <th class="p-4 text-left font-semibold">Price</th> <th class="p-4 text-left font-semibold">Users</th> <th class="p-4 text-left font-semibold">Storage</th> <th class="p-4 text-left font-semibold">Support</th> </tr> </thead> <tbody> <tr> <td class="p-4 font-medium">Starter</td> <td class="p-4">$29/mo</td> <td class="p-4">Up to 5</td> <td class="p-4">10 GB</td> <td class="p-4">Email</td> </tr> <tr class="bg-indigo-50"> <td class="p-4 font-medium">Pro</td> <td class="p-4">$79/mo</td> <td class="p-4">Up to 10</td> <td class="p-4">50 GB</td> <td class="p-4">Priority</td> </tr> <tr> <td class="p-4 font-medium">Enterprise</td> <td class="p-4">Custom</td> <td class="p-4">Unlimited</td> <td class="p-4">Custom</td> <td class="p-4">24/7</td> </tr> </tbody> </table> </div> ); }
Compact Team Directory
Uses a tight 0.4rem
spacing for dense information display.
import tailwindConfig from "./tailwind.config.js"; tailwind.config = tailwindConfig; // App.js export default function TeamDirectory() { return ( <div class="p-8"> <h3 class="text-xl font-bold mb-4">Compact Team Directory</h3> <p class="mb-4">A dense table layout with minimal spacing for information-heavy displays</p> <table class="border-separate border-spacing-compact bg-white shadow-md rounded-lg overflow-hidden"> <thead class="bg-gray-100"> <tr> <th class="p-3 text-left font-semibold">Name</th> <th class="p-3 text-left font-semibold">Role</th> <th class="p-3 text-left font-semibold">Department</th> <th class="p-3 text-left font-semibold">Status</th> </tr> </thead> <tbody> <tr class="border-t border-gray-200"> <td class="p-3">Sarah Wilson</td> <td class="p-3">Lead Designer</td> <td class="p-3">Design</td> <td class="p-3"><span class="px-2 py-1 bg-green-100 text-green-800 rounded-full text-sm">Active</span></td> </tr> <tr class="border-t border-gray-200"> <td class="p-3">Michael Brown</td> <td class="p-3">Developer</td> <td class="p-3">Engineering</td> <td class="p-3"><span class="px-2 py-1 bg-green-100 text-green-800 rounded-full text-sm">Active</span></td> </tr> <tr class="border-t border-gray-200"> <td class="p-3">Emily Davis</td> <td class="p-3">Product Manager</td> <td class="p-3">Product</td> <td class="p-3"><span class="px-2 py-1 bg-yellow-100 text-yellow-800 rounded-full text-sm">Away</span></td> </tr> </tbody> </table> </div> ); }
Best Practices
Maintain Design Consistency
When applying Border Spacing in Tailwind CSS, consistency is essential for achieving a polished and professional design. You should align your spacing strategy with the project's overall design language and ensure uniformity across components. For instance, if a layout utilizes border-spacing-4
for content separation in one table, replicate the same spacing for other tabular structures to maintain coherence. Consistent spacing contributes to a balanced visual hierarchy, preventing user interfaces from appearing disorganized or fragmented.
Tailwind’s configuration system enables you to extend spacing utilities globally, ensuring a consistent approach. You can predefine custom spacing values by editing the tailwind.config.cjs
file. For example, setting border-spacing-compact
and border-spacing-wide
values helps you establish reusable conventions across dozens of components.
Optimize for Reusability
Reusability is a cornerstone of Tailwind CSS. When applying Border Spacing, consider modularizing components by encapsulating commonly used layouts into flexible JSX functions.
For example, a reusable product stats table component ensures consistent spacing across all such tables in the product and saves development time.
Accessibility Considerations
Enhance Readability and Navigability
Border Spacing isn’t just about aesthetics—it has a direct impact on the readability and navigability of content. By ensuring adequate spacing between elements such as table cells, you help users quickly distinguish related information and navigate seamlessly. For accessible web design, aim for logical groupings where spacing indicates structural relationships.
For example, increasing spacing between records in dense datasets enhances clarity, particularly for users with cognitive challenges.
Focus on High Contrast
Pairing colors effectively with Border Spacing optimizes contrast, critical for users with low vision. Tight spacing can merge adjacent elements visually, while overly large gaps might introduce ambiguity. Choose spacing values that uphold clear boundaries without introducing unnecessary complexity.
Use border-spacing-*
alongside color utilities like bg-*
and text-*
to highlight or separate interface elements. For example:
export default function HighContrastGrid() { return ( <div className="p-4 bg-gray-800 text-white h-screen"> <table className="border-separate border-spacing-8 w-full"> <thead className="bg-gray-700"> <tr> <th className="p-4 text-left">Category</th> <th className="p-4 text-left">Description</th> </tr> </thead> <tbody> <tr> <td className="p-4 bg-gray-900 border">Tech</td> <td className="p-4 bg-gray-900 border">Latest trends in software.</td> </tr> </tbody> </table> </div> ); }