Getting Started
BinaryCSS is a modern, lightweight, and modular CSS framework designed to help developers build beautiful, responsive websites with ease. It provides a comprehensive suite of utility classes, a responsive grid system, and pre-built components.
Installation
You can include BinaryCSS in your project in several ways:
Basic Usage
Here's a simple HTML template to get you started:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My BinaryCSS Project</title>
<link rel="stylesheet" href="path/to/Binary.css">
</head>
<body>
<div class="container">
<h1>Hello, BinaryCSS!</h1>
<div class="row">
<div class="col-md-6">
<div class="card">
<div class="card-body">
<h5 class="card-title">Card Title</h5>
<p class="card-text">Some quick example text to build on the card.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-body">
<h5 class="card-title">Card Title</h5>
<p class="card-text">Some quick example text to build on the card.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
</div>
</div>
</div>
<script src="path/to/Binary.js"></script>
</body>
</html>
Browser Support
BinaryCSS is designed to work in all modern browsers. The framework is tested and compatible with:
Chrome
Firefox
Safari
Edge
Opera
Layout
Grid System
BinaryCSS includes a responsive 12-column grid system that helps you create flexible layouts for any screen size.
Advanced Grid Examples
Responsive Breakpoints
The grid system includes six tiers of predefined classes for building responsive layouts:
| Breakpoint | Class Prefix | Screen Width |
|---|---|---|
| Extra small | col- |
<576px |
| Small | col-sm- |
≥576px |
| Medium | col-md- |
≥768px |
| Large | col-lg- |
≥992px |
| Extra large | col-xl- |
≥1200px |
| Extra extra large | col-xxl- |
≥1400px |
<div class="container">
<div class="row">
<div class="col-md-6">Content</div>
<div class="col-md-6">Content</div>
</div>
</div>
Utility Classes
BinaryCSS provides a comprehensive set of utility classes to quickly style elements without writing custom CSS.
Typography Utilities
Quickly style text with typography utilities:
.text-primary - Primary text color
.text-center - Centered text
.text-uppercase - UPPERCASE TEXT
.text-lg .fw-bold - Large, bold text
.text-muted - Muted text for less emphasis
Font Sizes
- .text-xs
- .text-sm
- .text-base
- .text-lg
- .text-xl
- .text-2xl
- .text-3xl
- .text-4xl
Font Weights
- .font-thin
- .font-light
- .font-normal
- .font-medium
- .font-semibold
- .font-bold
- .font-extrabold
- .font-black
Text Alignments
-
.text-left → Aligned Left
-
.text-center → Centered
-
.text-right → Aligned Right
-
.text-justify → Justified
Border Utilities
Apply borders and border styles with utility classes:
Border Presence
Border Widths
Border Colors
Border Radius
Width & Height Utilities
Width
Height
Arbitrary Height and Width
Define custom dimensions for your elements:
📐 Flex Utilities Documentation
.flex / .inline-flex
Flex Direction
Flex Wrap
Justify Content
Align Items
Align Self
Flex Grow & Shrink
Flex Basis
Flexbox Utilities
Use flexbox utilities to build flexible layouts:
<div class="d-flex justify-content-between">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</div>
Spacing Utilities
Control margin and padding with responsive utility classes:
Margin Utilities
Padding Utilities
Arbitrary Values
BinaryCSS supports arbitrary values for more flexibility:
Arbitrary Margin and Padding
Combination Examples
<!-- Margin -->
<div class="mt-4">Margin top</div>
<div class="mb-5">Margin bottom</div>
<div class="mx-auto">Horizontal centering</div>
<!-- Padding -->
<div class="p-3">Padding all sides</div>
<div class="py-4">Padding top and bottom</div>
<div class="px-5">Padding left and right</div>
Color Utilities
Apply text and background colors with utility classes:
Font Color and Background Color Utilities
Font Color
Background Color
Arbitrary Colors
Components
BinaryCSS includes a variety of reusable components to help you build common UI patterns.
Color Buttons
Outline Color Buttons
<!-- Basic Buttons -->
<button class="btn btn-primary">Primary</button>
<button class="btn btn-secondary">Secondary</button>
<button class="btn btn-success">Success</button>
<button class="btn btn-danger">Danger</button>
<button class="btn btn-warning">Warning</button>
<!-- Outline Buttons -->
<button class="btn btn-outline-primary">Primary</button>
<button class="btn btn-outline-secondary">Secondary</button>
<!-- Button Sizes -->
<button class="btn btn-primary btn-sm">Small</button>
<button class="btn btn-primary">Default</button>
<button class="btn btn-primary btn-lg">Large</button>
<!-- Button with Icons -->
<button class="btn btn-primary">
<i class="fas fa-download mr-1"></i> Download
</button>
Cards
Cards are flexible content containers with multiple variants:
Colored Border Card
Card Subtitle
Some quick example text to build on the card.
Card link Another linkAdvanced Cards
.card--centered or
.card--shadowless.
<!-- Basic Card -->
<div class="card">
<div class="card-body">
<h5 class="card-title">Card Title</h5>
<p class="card-text">Some quick example text to build on the card.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
<!-- Card with Image (with fallback) -->
<div class="card">
<div class="card-img-container">
<img
src="path/to/image.jpg"
class="card-img-top"
alt="Card image"
width="100%"
height="200"
onerror="this.onerror=null; this.src='path/to/fallback.jpg';"
>
</div>
<div class="card-body">
<h5 class="card-title">Card Title</h5>
<p class="card-text">Some quick example text.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
</div>
<!-- Card with Header and Footer -->
<div class="card">
<div class="card-header">Featured</div>
<div class="card-body">
<h5 class="card-title">Card Title</h5>
<p class="card-text">Some text here.</p>
<a href="#" class="btn btn-primary">Go somewhere</a>
</div>
<div class="card-footer">
<small class="text-muted">Last updated 3 mins ago</small>
</div>
</div>
Image Loading Best Practices
When using images in cards, follow these best practices to improve performance and user experience:
- Specify dimensions: Always include width and height attributes to prevent layout shifts during page load.
- Use fallbacks: Implement the onerror attribute to handle cases where images fail to load.
- Optimize images: Compress images and use appropriate formats (WebP for modern browsers, with JPEG/PNG fallbacks).
- Lazy loading: For long pages with many images, consider adding the loading="lazy" attribute.
<!-- Advanced Image Handling -->
<div class="card-img-container">
<img
src="image.jpg"
class="card-img-top"
alt="Descriptive alt text"
width="100%"
height="200"
loading="lazy"
onerror="this.onerror=null; this.src='fallback.jpg';"
>
</div>
Alerts
Provide contextual feedback messages for typical user actions:
Alert Variants
<div class="alert alert-primary">
This is a primary alert—check it out!
</div>
<div class="alert alert-success">
This is a success alert—check it out!
</div>
<div class="alert alert-danger">
This is a danger alert—check it out!
</div>
<div class="alert alert-warning">
This is a warning alert—check it out!
</div>
<div class="alert alert-info">
This is an info alert—check it out!
</div>
Forms
Style form controls and components with BinaryCSS:
Contact Form Example
<form>
<div class="form-group">
<label for="exampleFormControlInput1" class="form-label">Email address</label>
<input type="email" class="form-control" id="exampleFormControlInput1" placeholder="name@example.com">
</div>
<div class="form-group">
<label for="exampleFormControlSelect1" class="form-label">Example select</label>
<select class="form-control" id="exampleFormControlSelect1">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
<div class="form-group">
<label for="exampleFormControlTextarea1" class="form-label">Example textarea</label>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
<label class="form-check-label" for="flexCheckDefault">
Default checkbox
</label>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
Badges
Use badges to add counts, labels, or status indicators to elements:
<span class="badge">Default</span>
<span class="badge success">Success</span>
<span class="badge warning">Warning</span>
<span class="badge danger">Danger</span>
Tables
Style tables with BinaryCSS for better readability and organization:
| # | Name | Status | |
|---|---|---|---|
| 1 | Alice | Active | alice@example.com |
| 2 | Bob | Pending | bob@example.com |
| 3 | Charlie | Banned | charlie@example.com |
<table class="table">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>Status</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Alice</td>
<td><span class="badge success">Active</span></td>
<td>alice@example.com</td>
</tr>
<tr>
<td>2</td>
<td>Bob</td>
<td><span class="badge warning">Pending</span></td>
<td>bob@example.com</td>
</tr>
</tbody>
</table>
JavaScript Components
BinaryCSS includes several JavaScript components to add interactive features to your site.
Interactive Modal
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Modal content goes here...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
Custom Tooltips
Hover me Success tooltip Hover me Danger text tooltip<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="top" title="Tooltip on top">
Tooltip on top
</button>
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="right" title="Tooltip on right">
Tooltip on right
</button>
Dropdowns
Create toggleable, contextual menu for displaying lists of links and actions:
contextual menu for displaying lists of links and actions:<div class="dropdown">
<button class="dropdown-toggle btn btn-green">Select Option</button>
<div class="dropdown-menu">
<a href="#">Option 1</a>
<a href="#">Option 2</a>
<a href="#">Option 3</a>
</div>
</div>
Collapse
Toggle the visibility of content with the collapse JavaScript plugin:
Accordion Example
<p>
<a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
Link with href
</a>
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
Button with data-target
</button>
</p>
<div class="collapse" id="collapseExample">
<div class="card card-body">
Some placeholder content for the collapse component.
</div>
</div>
Carousel
Create a slideshow component for cycling through elements:
<div class="carousel">
<div class="carousel-track">
<div class="carousel-item">
<img src="path/to/image1.jpg" alt="Slide 1">
</div>
<div class="carousel-item">
<img src="path/to/image2.jpg" alt="Slide 2">
</div>
<div class="carousel-item">
<img src="path/to/image3.jpg" alt="Slide 3">
</div>
</div>
<div class="carousel-controls">
<button data-carousel="prev">❮</button>
<button data-carousel="next">❯</button>
</div>
</div>
Responsive Images
BinaryCSS provides utility classes for responsive and styled images:
<!-- Rounded corners image -->
<img src="image.jpg" alt="Rounded" class="img-rounded">
<!-- Circle/oval image -->
<img src="image.jpg" alt="Circle" class="img-circle">
<!-- Responsive image (full width of container) -->
<img src="image.jpg" alt="Responsive" class="img-responsive">
Arbitrary Font Size and Color
Apply custom typography styles:
text-[3rem] tc-[cyan]
text-[5.2rem] text-red
text-[clamp(1rem,2vw,2rem)] - Responsive clamped text
tc-[red]
tc-[#3366ff]
tc-[rgb(255,0,128)]
tc-[hsl(120,100%,50%)]
Arbitrary Background Color
Apply custom background colors to elements:
<!-- Arbitrary margin and padding -->
<div class="m-[2em] p-[2em]">Custom margin and padding</div>
<!-- Arbitrary width and height -->
<div class="w-[10rem] h-[10rem]">Custom width and height</div>
<!-- Arbitrary font size and color -->
<p class="text-[3rem] tc-[cyan]">Large cyan text</p>
<!-- Arbitrary background color -->
<div class="bg-[#D6FFF6]">Custom background color</div>