butterfly css

an attribute-based CSS framework by Amr kilany.

Introduction

butterfly css is a lightweight, attribute-based CSS framework designed to simplify common styling tasks and add engaging visual effects to your web projects. By simply adding specific attributes to your HTML elements, you can apply predefined styles for backgrounds, shapes, animations, hover effects, buttons, and a wide range of colors.

This documentation provides a comprehensive guide to all available attributes, from installation to detailed descriptions and examples.

Installation

To use Flamingo CSS, simply add a <link> tag in the <head> section of your HTML document, pointing to your hosted float.css file:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Flamingo Project</title>
    <!-- Include Inter font for better typography -->
    <link href="https://amr2010m.github.io/butterfly-css/float.css" rel="stylesheet">
    <!-- Link to your Flamingo CSS file -->
    <">
</head>
<body>
    <!-- Your content here -->
</body>
</html>

Important Note on Attributes: For Flamingo CSS to work, you apply its custom attributes directly to your HTML elements, **without square brackets** in the HTML tag itself.

For example, to apply flexbox styles for a row, you would write:

<div flex-row>...</div>
And for a purple button, it would be:
<button btn='purple'>...</button>

The `float.css` file contains CSS rules that are internally designed to recognize these attributes without the need for square brackets in your HTML. This allows for a clean and intuitive way to add styles. Please make sure you use the attributes exactly as shown in the examples below for them to work correctly!

Layout Utilities

`flex-row` attribute

Applies `display: flex` with `flex-direction: row`, and centers items horizontally and vertically.

<div flex-row>...</div>
Item 1 Item 2
`flex-column` attribute

Applies `display: flex` with `flex-direction: column`, and centers items horizontally and vertically.

<div flex-column>...</div>
Item 1 Item 2
`center` attribute

Centers an item within its flex container (`align-self: center; justify-self: center;`).

<div flex-row><span center>...</span></div>
Centered

Background Utilities

`bg='auto'` attribute

Sets background to `center`, `no-repeat`, and `cover`.

<div bg='auto'></div>
`glow` attribute

Applies an inset box shadow with a linear gradient, creating a glow effect.

<div glow></div>

Clip-Path Shapes

These attributes apply various geometric shapes using `clip-path`.

`circle` attribute

Clips the element into a perfect circle.

<div circle></div>
Circle
`triangle` attribute

Clips the element into a triangle.

<div triangle></div>
Triangle
`ellipse` attribute

Clips the element into an ellipse.

<div ellipse></div>
Ellipse
`square` attribute

Ensures the element is a square clip path (inset 0).

<div square></div>
Square
`rectangle` attribute

Clips the element into a rectangle (with 10% inset on top/bottom).

<div rectangle></div>
Rectangle
`diamond` attribute

Clips the element into a diamond shape.

<div diamond></div>
Diamond
`hexagon` attribute

Clips the element into a hexagon shape.

<div hexagon></div>
Hexagon
`parallelogram` attribute

Clips the element into a parallelogram.

<div parallelogram></div>
Parallelogram
`star` attribute

Clips the element into a star shape.

<div star></div>
Star
`trapezoid` attribute

Clips the element into a trapezoid shape.

<div trapezoid></div>
Trapezoid
`sharp` attribute

Applies a complex, jagged clip path.

<div sharp></div>
Sharp
`wave` attribute

Applies a wave-like clip path at the top.

<div wave></div>
Wave
`home` attribute

Clips the element into a classic house shape.

<div home></div>
Home
`mobile` attribute

Sets a fixed height and width with border-radius to resemble a mobile phone.

<div mobile></div>
Mobile
`tv` attribute

Clips the element into a television screen shape.

<div tv></div>
TV
`slope` attribute

Clips the element into a sloping parallelogram.

<div slope></div>
Slope
`heart` attribute

Clips the element into a heart shape.

<div heart></div>
Heart
`broken` attribute

Applies a jagged, broken-looking clip path.

<div broken></div>
Broken
`x` attribute

Clips the element into an 'X' shape.

<div x></div>
X Shape
`message` attribute

Clips the element into a message bubble shape with a pointer at the bottom.

<div message></div>
Message
`norad` attribute

Applies a complex, slightly irregular octagonal clip path.

<div norad></div>
Norad

Standard Animations

These attributes apply various continuous animations to elements. These are general-purpose motion effects.

`spin` attribute

Continuously rotates the element 360 degrees.

<div spin></div>
Spin
`bounce` attribute

Makes the element bounce vertically.

<div bounce></div>
Bounce
`pulse` attribute

Makes the element grow slightly and fade in/out.

<div pulse></div>
Pulse
`swing` attribute

Makes the element wiggle from side to side.

<div swing></div>
Swing
`fadein` attribute

Fades the element in while sliding up.

<div fadein></div>
Fade In
`flip` attribute

Flips the element horizontally.

<div flip></div>
Flip
`shake` attribute

Makes the element shake horizontally.

<div shake></div>
Shake
`grow` attribute

Makes the element continuously grow and shrink.

<div grow></div>
Grow
`shrink` attribute

Makes the element continuously shrink and grow.

<div shrink></div>
Shrink
`slide-x` attribute

Slides the element horizontally left and right.

<div slide-x></div>
Slide X
`slide-y` attribute

Slides the element vertically up and down.

<div slide-y></div>
Slide Y

Coloring Animations

These attributes apply animated background color changes using predefined palettes.

`coloring` attribute

Applies a generic background color animation (changes every 1s).

<div coloring></div>
Coloring
`coloring-1` to `coloring-50` attributes

Each attribute applies a specific 3-color background animation over 3 seconds. For example, `coloring-1` animates between `#ff00b74f`, `#c800ff33`, and `#ffffff`.

<div coloring-1></div>
Coloring-1
`coloring-2` attribute

Specific 3-color background animation (green, yellow, orange).

<div coloring-2></div>
Coloring-2
`coloring-3` attribute

Specific 3-color background animation (red, cyan, light purple).

<div coloring-3></div>
Coloring-3
`coloring-X` attributes

Continue for `coloring-4` through `coloring-50`, each offering a unique 3-color background animation. Refer to the CSS file for exact color values.

<div coloring-4></div>
<div coloring-50></div>

Floating Ball Animations

These attributes create glowing, animated balls that float across the element using `::before` pseudo-elements. The parent element should have `position: relative` and `overflow: hidden` for best results.

`ball-move-1` attribute

A glowing ball animation with a specific path and speed.

<div style="..." ball-move-1></div>

Ball 1

`ball-move-2` attribute

Another glowing ball animation with a different path and speed.

<div style="..." ball-move-2></div>

Ball 2

`ball-move-3` attribute

A larger glowing ball animation.

<div style="..." ball-move-3></div>

Ball 3

`ball-move-4` attribute

A faster, smaller glowing ball animation.

<div style="..." ball-move-4></div>

Ball 4

`ball-move-5` attribute

A very large, slow glowing ball animation.

<div style="..." ball-move-5></div>

Ball 5

Special Effects

These attributes apply unique visual effects to elements, often using pseudo-elements or SVG filters.

`birthday-paper` attribute

Creates a confetti-like falling paper animation over the element. The parent element should have `position: relative` and `overflow: hidden`.

<div style="..." birthday-paper></div>
Happy Birthday!
`lightfouce` attribute

Applies a subtle, moving spotlight/light focus effect to the element. The element itself should have a background color for the effect to be visible. Needs `position: relative` and `overflow: hidden`.

<div style="..." lightfouce></div>
Focused Content
`handdrawn` attribute

Gives the element a hand-drawn or sketchy appearance using an SVG filter, with a hover effect. Requires `Caveat` or `Comic Sans MS` font for the example to match.

<div handdrawn></div>
Sketchy Box
`arrow` attribute

Applies an arrow background image with specific styling. Useful for directional indicators.

<div arrow></div>
Arrow
`blur` attribute

Applies a `filter: blur(2px)` to the element.

<div blur></div>
Blurred

Rotate Utilities

Apply specific rotations to elements. These attributes provide rotation in 1-degree increments from 0 to 360 degrees. Responsive variants are also available.

`rotate="0"` to `rotate="360"` attributes

Rotates the element by the specified degree (e.g., `rotate="45"` for 45 degrees, `rotate="180"` for 180 degrees). Values are in degrees without units in the attribute itself.

<div rotate="45"></div>
45°
`sm-rotate="X"`, `md-rotate="X"`, `lg-rotate="X"`, `xl-rotate="X"`, `dt-rotate="X"` attributes

Responsive rotation utilities. Apply rotation only at or above specific breakpoints (Small, Medium, Large, Extra Large, Desktop). `X` represents the degree from 0 to 360.

<div sm-rotate="90"></div>
<div dt-rotate="270"></div>
Responsive Rotate

Width & Height Utilities

These attributes allow you to set fixed widths and heights for elements in pixels.

`w-1` to `w-999` attributes

Sets the width of the element from 1 pixel to 999 pixels. For example, `w-100` sets width to 100px.

<div w-150></div>
Width 150px
`h-1` to `h-999` attributes

Sets the height of the element from 1 pixel to 999 pixels. For example, `h-200` sets height to 200px.

<div h-120></div>
Height 120px

Hover Effects

These attributes apply a specific effect when the element is hovered over.

`hover-1` attribute (Scale up)

Scales the element up slightly on hover (1.08).

<div hover-1></div>
Hover
`hover-2` attribute (Scale down)

Scales the element down slightly on hover (0.92).

<div hover-2></div>
Hover
`hover-3` attribute (Rotate)

Rotates the element 8 degrees on hover.

<div hover-3></div>
Hover
`hover-4` attribute (Shadow pop)

Applies a subtle shadow pop effect on hover.

<div hover-4></div>
Hover
`hover-5` attribute (Glow)

Applies a vibrant glow effect on hover (pink shadow).

<div hover-5></div>
Hover
`hover-6` attribute (Border color)

Changes border color to `#6600ff` on hover.

<div hover-6></div>
Hover
`hover-7` attribute (Gradient background)

Applies a specific green/cyan gradient background on hover.

<div hover-7></div>
Hover
`hover-8` attribute (Blur)

Applies a blur effect (`filter: blur(2px)`) on hover.

<div hover-8></div>
Hover
`hover-9` attribute (Skew)

Skews the element (`skew(-10deg,2deg)`) on hover.

<div hover-9></div>
Hover
`hover-10` attribute (Opacity)

Reduces opacity to `0.7` on hover.

<div hover-10></div>
Hover
`hover-11` attribute (Pulse animation)

Applies a pulse animation (grow/shrink) on hover.

<div hover-11></div>
Hover
`hover-12` attribute (Wiggle animation)

Applies a wiggle animation (rotate -5deg to 5deg) on hover.

<div hover-12></div>
Hover
`hover-13` attribute (Bounce animation)

Applies a bounce animation on hover.

<div hover-13></div>
Hover
`hover-14` attribute (Flip animation)

Flips the element horizontally (`rotateY(180deg)`) on hover.

<div hover-14></div>
Hover
`hover-15` attribute (Slide right)

Slides the element 20px to the right on hover.

<div hover-15></div>
Hover
`hover-16` attribute (Slide left)

Slides the element 20px to the left on hover.

<div hover-16></div>
Hover
`hover-17` attribute (Slide up)

Slides the element 20px up on hover.

<div hover-17></div>
Hover
`hover-18` attribute (Slide down)

Slides the element 20px down on hover.

<div hover-18></div>
Hover
`hover-19` attribute (Text color)

Changes text color to pink (`#ff6fd8`) on hover.

<div hover-19></div>
Hover
`hover-20` attribute (Shadow inset)

Applies an inset shadow on hover.

<div hover-20></div>
Hover
`hover-21` attribute (Border radius)

Changes border-radius to 50px (fully rounded) on hover.

<div hover-21></div>
Hover
`hover-22` attribute (Grayscale)

Applies a grayscale filter (`filter: grayscale(1)`) on hover.

<div hover-22></div>
Hover
`hover-23` attribute (Saturate)

Increases saturation (`filter: saturate(2)`) on hover.

<div hover-23></div>
Hover
`hover-24` attribute (Hue rotate)

Rotates hue by 90 degrees (`filter: hue-rotate(90deg)`) on hover.

<div hover-24></div>
Hover
`hover-25` attribute (Shadow neon)

Applies a vibrant cyan/blue neon shadow on hover.

<div hover-25></div>
Hover
`hover-26` attribute (Border dashed)

Changes border style to dashed on hover.

<div hover-26></div>
Hover
`hover-27` attribute (Border dotted)

Changes border style to dotted on hover.

<div hover-27></div>
Hover
`hover-28` attribute (Glass effect)

Applies a subtle glass effect (`backdrop-filter: blur(8px)`) on hover. Works best on elements with content behind them.

<div hover-28></div>
Hover
`hover-29` attribute (Shadow color)

Changes shadow color to yellow (`#ffd20088`) on hover.

<div hover-29></div>
Hover

Morph Hover Effects

These attributes allow an element's clip-path to smoothly transition to a different shape on hover.

`morph-hover="star"` attribute

On hover, the element transitions into a star shape. Combine with an initial shape like `circle` or `square`.

<div morph-hover="star" circle></div>
Morph to Star
`morph-hover="circle"` attribute

On hover, the element transitions into a circle shape. Combine with an initial shape like `square` or `triangle`.

<div morph-hover="circle" square></div>
Morph to Circle
`morph-hover="hexagon"` attribute

On hover, the element transitions into a hexagon shape. Combine with an initial shape.

<div morph-hover="hexagon" triangle></div>
Morph to Hexagon
`morph-hover="diamond"` attribute

On hover, the element transitions into a diamond shape. Combine with an initial shape.

<div morph-hover="diamond" ellipse></div>
Morph to Diamond

Gradients

Apply modern linear gradients as background colors.

`gradient-1` attribute

Gradient from #6600FF to #FF6FD8.

<div gradient-1></div>
`gradient-2` attribute

Gradient from #43e97b to #38f9d7.

<div gradient-2></div>
`gradient-3` attribute

Gradient from #f7971e to #ffd200.

<div gradient-3></div>
`gradient-4` attribute

Gradient from #f953c6 to #b91d73.

<div gradient-4></div>
`gradient-5` attribute

Gradient from #30cfd0 to #330867.

<div gradient-5></div>
`gradient-6` attribute

Gradient from #5ee7df to #b490ca.

<div gradient-6></div>
`gradient-7` attribute

Gradient from #ee9ca7 to #ffdde1.

<div gradient-7></div>
`gradient-8` attribute

Gradient from #f6d365 to #fda085.

<div gradient-8></div>
`gradient-9` attribute

Gradient from #6600ff to #c6e8f8.

<div gradient-9></div>
`gradient-10` attribute

Gradient from #ffffff to #00c3ff.

<div gradient-10></div>

Components

Card

`card` attribute

A styled card component with padding, border-radius, and shadow, with a subtle hover effect.

<div card>...</div>

Card Title

This is some content inside a Flamingo CSS card.

Button

`button` attribute

A base styled button with padding, border-radius, background, and hover effects.

<button button>Click Me</button>
`btn='{color}'` attributes

Predefined colored buttons. Replace `{color}` with a wide range of colors. Hover effects are included.

<button btn='purple'>Purple</button>
<button btn='green'>Green</button>
<button btn='rose'>Rose</button>

This includes a full spectrum of colors for `btn='{color}'` attributes. Please refer to the `float.css` file for the exact color definitions.

Background Colors

Set background colors using attribute selectors for basic colors and various shades (e.g., `red`, `red-500`). These apply `!important` to override other styles.

Basic Colors

`red` attribute

Sets background to a vibrant red.

<div red></div>
`pink` attribute

Sets background to a vibrant pink.

<div pink></div>
`purple` attribute

Sets background to a deep purple.

<div purple></div>
`deep-purple` attribute

Sets background to a darker purple.

<div deep-purple></div>
`indigo` attribute

Sets background to an indigo blue.

<div indigo></div>
`blue` attribute

Sets background to a standard blue.

<div blue></div>
`light-blue` attribute

Sets background to a light blue.

<div light-blue></div>
`cyan` attribute

Sets background to a cyan blue.

<div cyan></div>
`teal` attribute

Sets background to a teal green.

<div teal></div>
`green` attribute

Sets background to a vibrant green.

<div green></div>
`light-green` attribute

Sets background to a light green.

<div light-green></div>
`lime` attribute

Sets background to a lime green.

<div lime></div>
`yellow` attribute

Sets background to a golden yellow.

<div yellow></div>
`amber` attribute

Sets background to an amber yellow.

<div amber></div>
`orange` attribute

Sets background to an orange.

<div orange></div>
`deep-orange` attribute

Sets background to a deep orange.

<div deep-orange></div>
`brown` attribute

Sets background to a brown.

<div brown></div>
`gray` attribute

Sets background to a standard gray.

<div gray></div>
`blue-gray` attribute

Sets background to a blue-gray.

<div blue-gray></div>
`black` attribute

Sets background to a dark black.

<div black></div>
`white` attribute

Sets background to white.

<div white></div>
`light` attribute

Sets background to a very light purple/gray (`#f8f7ff`).

<div light></div>
`dark` attribute

Sets background to a dark gray/blue (`#22223b`).

<div dark></div>

Shaded Colors (e.g., `red-50` to `red-900`)

Each major color (red, blue, green, yellow, purple, gray) has 10 shades from 50 (lightest) to 900 (darkest).

`red-50` to `red-900` attributes

Various shades of red background.

<div red-50></div>
<div red-500></div>
<div red-900></div>
`blue-50` to `blue-900` attributes

Various shades of blue background.

<div blue-50></div>
<div blue-500></div>
<div blue-900></div>
`green-50` to `green-900` attributes

Various shades of green background.

<div green-50></div>
<div green-500></div>
<div green-900></div>
`yellow-50` to `yellow-900` attributes

Various shades of yellow background.

<div yellow-50></div>
<div yellow-500></div>
<div yellow-900></div>
`purple-50` to `purple-900` attributes

Various shades of purple background.

<div purple-50></div>
<div purple-500></div>
<div purple-900></div>
`gray-50` to `gray-900` attributes

Various shades of gray background.

<div gray-50></div>
<div gray-500></div>
<div gray-900></div>

Text Colors

Set text colors using attribute selectors, prefixed with `t` for basic colors and various shades (e.g., `tred`, `tred-500`). These apply `!important` to override other styles.

Basic Text Colors

`tred` attribute

Sets text color to a vibrant red.

<span tred>...</span>

Red Text

`tpink` attribute

Sets text color to a vibrant pink.

<span tpink>...</span>

Pink Text

`tpurple` attribute

Sets text color to a deep purple.

<span tpurple>...</span>

Purple Text

`tdeep-purple` attribute

Sets text color to a darker purple.

<span tdeep-purple>...</span>

Deep Purple Text

`tindigo` attribute

Sets text color to an indigo blue.

<span tindigo>...</span>

Indigo Text

`tblue` attribute

Sets text color to a standard blue.

<span tblue>...</span>

Blue Text

`tlight-blue` attribute

Sets text color to a light blue.

<span tlight-blue>...</span>

Light Blue Text

`tcyan` attribute

Sets text color to a cyan blue.

<span tcyan>...</span>

Cyan Text

`tteal` attribute

Sets text color to a teal green.

<span tteal>...</span>

Teal Text

`tgreen` attribute

Sets text color to a vibrant green.

<span tgreen>...</span>

Green Text

`tlight-green` attribute

Sets text color to a light green.

<span tlight-green>...</span>

Light Green Text

`tlime` attribute

Sets text color to a lime green.

<span tlime>...</span>

Lime Text

`tyellow` attribute

Sets text color to a golden yellow.

<span tyellow>...</span>

Yellow Text

`tamber` attribute

Sets text color to an amber yellow.

<span tamber>...</span>

Amber Text

`torange` attribute

Sets text color to an orange.

<span torange>...</span>

Orange Text

`tdeep-orange` attribute

Sets text color to a deep orange.

<span tdeep-orange>...</span>

Deep Orange Text

`tbrown` attribute

Sets text color to a brown.

<span tbrown>...</span>

Brown Text

`tgray` attribute

Sets text color to a standard gray.

<span tgray>...</span>

Gray Text

`tblue-gray` attribute

Sets text color to a blue-gray.

<span tblue-gray>...</span>

Blue-Gray Text

`tblack` attribute

Sets text color to a dark black.

<span tblack>...</span>

Black Text

`twhite` attribute

Sets text color to white.

<span twhite>...</span>

White Text

`tlight` attribute

Sets text color to a very light purple/gray.

<span tlight>...</span>

Light Text

`tdark` attribute

Sets text color to a dark gray/blue.

<span tdark>...</span>

Dark Text

Shaded Text Colors (e.g., `tred-50` to `tred-900`)

Each major color (red, blue, green, yellow, purple, gray) has 10 shades from 50 (lightest) to 900 (darkest).

`tred-50` to `tred-900` attributes

Various shades of red text.

<span tred-50>Text</span>
<span tred-500>Text</span>
<span tred-900>Text</span>
Text Text Text Text Text
`tblue-50` to `tblue-900` attributes

Various shades of blue text.

<span tblue-50>Text</span>
Text Text Text Text Text
`tgreen-50` to `tgreen-900` attributes

Various shades of green text.

<span tgreen-50>Text</span>
Text Text Text Text Text
`tyellow-50` to `tyellow-900` attributes

Various shades of yellow text.

<span tyellow-50>Text</span>
Text Text Text Text Text
`tpurple-50` to `tpurple-900` attributes

Various shades of purple text.

<span tpurple-50>Text</span>
Text Text Text Text Text
`tgray-50` to `tgray-900` attributes

Various shades of gray text.

<span tgray-50>Text</span>
Text Text Text Text Text