LegaCSS is a simple baseplate, designed to give you basic styles that most websites and browsers can understand, so you don't waste time rebuilding buttons, boxes, and layout basics from zero.
We have a different philosophy: being responsive is not the same as being compatible. A site can adapt to screen sizes and still leave older browsers behind. LegaCSS is built to do both at once, that's why we created this framework.
LegaCSS is browser friendly, it even works on IE 6, yes, IE 6. We believe in connectivity for everyone, and we don't want to limit people from visiting webpages just because their browser is outdated. There's usually a reason why it's outdated, and that's not our problem to fix, but we won't lock those users out either :)
<!--[if lt IE 7]> <html class="ie ie6 lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if lt IE 8]> <html class="ie ie7 lt-ie9 lt-ie8"> <![endif]-->
<!--[if lt IE 9]> <html class="ie ie8 lt-ie9"> <![endif]-->
<!--[if IE 9]> <html class="ie ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html class="no-ie ieEdge">
<!--<![endif]-->
<!--[if lt IE 7]> <body class="ie ie6 lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if lt IE 8]> <body class="ie ie7 lt-ie9 lt-ie8"> <![endif]-->
<!--[if lt IE 9]> <body class="ie ie8 lt-ie9"> <![endif]-->
<!--[if IE 9]> <body class="ie ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<body class="no-ie ieEdge">
<!--<![endif]-->
Remember to include Paul Irish's conditionals for Internet Explorer before you begin. This not only ensures that our framework works correctly in these browsers, but it also provides a simple way for framework users to create fallbacks easily.
Where conditional tags should be placed depends on the technology being used. In the case of HTML (HTML 4.01, HTML 5), the tags can be placed either in the <html> or in <body>. However, in the case of XHTML (XHTML 1.0, XHTML 5), they can only be placed in the <body> because the <html> serves a different purpose.
Note: Even if the baseplate works in Internet Explorer, that doesn't mean that all styles (modifiers) will work in Internet Explorer.
| Supported Browsers | ||
|---|---|---|
| Browser | Desktop | Mobile |
| Internet Explorer | 6+ | 9+ |
| Firefox | 3.6+ | |
| Opera | 11.1+ | 12+ |
| Konqueror | 4+ | |
| Safari | 4+ | 3.1+ |
| Chrome | 4+ | 46+ |
| Android Browser | 2.1+ | |
By default, the text is set to use the Arial, Helvetica, and sans-serif fonts at a base size of 12px (and 14px for resolutions lower than 620px like mobile phones), using EM units to allow the font size to be adjusted based on the device without the need for REM. This ensures that the website functions properly in all browsers.
The text includes the classic HTML tags: <b> and <strong> for bold text, <i> and <em> for italic text, and we've brought back the classic <u> tag for underlined text.
There are ways to modify the text of headings and paragraphs. For headings, you can use .subheading to display the heading text without bold formatting, while if you use <small>, the text will appear 60% smaller and in gray ideal for slogans or notes.
For paragraphs, if you use <small>, the text will appear 60% smaller ideal for short notes.
There are tags for highlighting text, using .highlight-[color]
.highlight-clear
.highlight-red
.highlight-green
.highlight-blue
.highlight-yellow
In addition, there are selectors for aligning text using align-[direction]
.align-left
.align-right
.align-center
Note: you also can use <center> to align items to center
<p> - Paragraph
Paragraph
<small> Paragraph
| <th> | ||
|---|---|---|
| <td> | <td> | <td> |
| <th> | <td> | <td> |
| <th> |
|---|
| <td> |
| <th> | <td> |
|---|
<table>
<thead>
<tr>
<th colspan="3"><th></th>
</tr>
<tr>
<td><td></td>
<td><td></td>
<td><td></td>
</tr>
</thead>
<tbody>
<tr>
<th><th></th>
<td><td></td>
<td><td></td>
</tr>
</tbody>
</table>
The CSS system is very specific when it comes to assigning classes. CSS follows this system:
<div class="[class] [class--modifyer] [class--modifyer-#]">
This is a an example 10px padding box with
<div class="box box--p-10">
<p>This is a an example 10px padding box with</p>
</div>
<div class="box box--p-10">
<p><a style="margin: 0;" href="" class="btn btn--regular btn--default btn--outline btn--radius btn--nice btn--red">Example</a></p>
</div>
We use a special layout system... to avoid any legal disputes with other frameworks. We drew inspiration from the naming conventions of the old IUSACELL website, and its behavior is based on how ZURB Foundation 2.x and Twitter Bootstrap 1.x work.
That's why we use the .container class for the outer block and .wrap for the inner block. This means that .container defines the outer space, and .wrap defines the inner space.
| .container | This causes the element to be displayed as block in its entirety on the page, with 12px of padding on each side. |
|---|---|
| .wrap | This goes inside .container and creates a 900px centered area, which adjusts based on the screen size. |
| .warp-fluid | This goes inside .container and creates a 100% area, which adjusts based on the screen size. |
| .container--ext | Set .wrap to stretch up to 1000px |
|---|---|
| .container--ext-plus | Set .wrap to stretch up to 1400px and change the side padding from 12px to 24px (for resolutions less than 922px, the padding remains 12px) |
<div class="container">
<div class="wrap">
</div>
</div>
<div class="container container--ext">
<div class="wrap">
</div>
</div>
<div class="container container--ext-plus">
<div class="wrap">
</div>
</div>
| .row | Defines the container for the table (applys ClearFix) |
|---|---|
| .row .row--spaced | Defines the container for the table (applys ClearFix) |
| .col | Define the styles for the column system. |
|---|---|
| .col .col--w-100 | Define the size for the column to 100%. |
| .col .col--w-90 | Define the size for the column to 90%. |
| .col .col--w-85 | Define the size for the column to 85%. |
| .col .col--w-80 | Define the size for the column to 80%. |
| .col .col--w-75 | Define the size for the column to 75%. |
| .col .col--w-66 | Define the size for the column to 66%. |
| .col .col--w-50 | Define the size for the column to 50%. |
| .col .col--w-33 | Define the size for the column to 33%. |
| .col .col--w-25 | Define the size for the column to 25%. |
| .col .col--w-20 | Define the size for the column to 20%. |
| .col .col--w-15 | Define the size for the column to 15%. |
| .col .col--w-10 | Define the size for the column to 10%. |
<div class="row">
<div class="col col--w-100">
</div>
</div>
<div class="row row--spaced">
<div class="col col--w-100">
</div>
</div>
The .box class simply resets floats (zoom: 1) and gives you a block-level element to pad. Padding is added through the .box--p-[size] modifiers, from 2 to 20 pixels, so you never need a custom inline style just to add spacing.
| .box--p-2 | 2px padding |
|---|---|
| .box--p-4 | 4px padding |
| .box--p-6 | 6px padding |
| .box--p-8 | 8px padding |
| .box--p-10 | 10px padding |
| .box--p-12 | 12px padding |
| .box--p-14 | 14px padding |
| .box--p-16 | 16px padding |
| .box--p-18 | 18px padding |
| .box--p-20 | 20px padding |
<div class="box box--p-10">
content
</div>
A .block is a full-width, self-clearing container (it applies ClearFix automatically) meant to wrap a colored panel, alert, or callout. Combine it with .box--p-[size] for the inner padding, same as you saw in the alert on the Welcome section.
| .block--outline | Adds a 1px solid border (negative margin keeps widths aligned) |
|---|---|
| .block--border-classic | Adds an old-school 2px outset (beveled) border, Win95/98 style |
| .block--radius | 4px rounded corners on the block, and on its .b-heading/.b-content if present (see "Block Headings" below) |
| .block--clear | Light gray background |
|---|---|
| .block--dark | Dark background, use with .block--txt-clear or .block--txt-white for the text |
| .block--classic | Flat Win95/98-gray background |
| .block--classic-y2k | Flat Win2000/XP-beige background |
| .block--red | Red background |
| .block--green | Green background |
| .block--blue | Blue background |
| .block--yellow | Yellow background |
| .block--txt-dark | Dark gray text, for light backgrounds |
|---|---|
| .block--txt-clear | Muted gray text, for dark backgrounds |
| .block--txt-black | Solid black text |
| .block--txt-white | Solid white text |
| .block--nice | Adds a subtle top-to-bottom gloss gradient to the block (falls back to flat color on old IE, see .lt-ie9 .block--nice). If the block has a .b-heading, .block--nice glosses the heading too |
|---|
Note: always pair a color modifier with a matching text-color modifier (e.g. .block--dark + .block--txt-clear) so the text stays readable.
Updated in V2.0: a titled panel is now built from two siblings inside .block, not one nested div — .b-heading for the title bar and .b-content for the body. When the block has .block--outline or .block--border-classic, both the heading and the content get their own matching border automatically (heading: full border; content: border-top only, so they read as one continuous panel). Add .block--radius to the block to round the heading's top corners and the content's bottom corners.
| .b-heading--black | Black heading, white text |
|---|---|
| .b-heading--white | Light gray heading, dark text |
| .b-heading--classic | Windows 95/98 title-bar look: flat navy blue, white text |
| .b-heading--classic-2k | Windows XP "Luna" title-bar look: blue gradient, white text |
| .b-heading--red | Red heading, white text |
| .b-heading--green | Green heading, white text |
| .b-heading--blue | Blue heading, white text |
| .b-heading--l-blue | Light blue heading, white text |
| .b-heading--yellow | Yellow heading, dark text |
Note: .b-heading--nice (or .block--nice on the parent) adds the gloss effect to the title bar only; the .b-content stays flat.
<div class="block block--outline block--radius">
<div class="b-heading b-heading--blue">Title</div>
<div class="b-content">Body</div>
</div>
A handful of no-frills utility classes are always available, independent of the grid or the button/block systems:
| .left | float: left |
|---|---|
| .right | float: right |
| .hide | display: none, always |
| .hide-lt-600 / .hide-lt-700 | Hides an element only under 600px / 700px width |
| .hide-700 / .hide-900 / .hide-1000 / .hide-1400 | Hides an element only above the matching breakpoint |
| .hide-ie6 / .hide-ie7 / .hide-ie8 / .hide-ie9 | Hides an element only in that version of Internet Explorer (needs the <html>/<body> IE conditional classes from "Before Starting") |
<div class="hide-ie6 hide-ie7">
Hidden on IE6 and IE7 only
</div>
Any <a> (or other inline element) becomes a button once you add .btn. From there you stack modifiers for size, position, border, corner shape, gloss effect and color — same "class + class--modifyer" system used everywhere else in LegaCSS.
| .btn--tiny | Smaller text and padding |
|---|---|
| .btn--regular | Default size |
| .btn--huge | Larger text and padding, good for calls-to-action |
| .btn--left | float: left |
|---|---|
| .btn--right | float: right |
| .btn--default | No float, clears both sides |
| .btn--default-full | Block-level, 100% width, no side padding |
| .btn--outline | 1px solid border |
|---|---|
| .btn--border-classic | 2px outset border, inset when :active (classic pressed-button feel) |
| .btn--radius | 4px rounded corners |
|---|---|
| .btn--round | 20px rounded (pill-shaped) corners |
| .btn--nice | Subtle top-lit gloss gradient, inverts on :active for a pressed look (skipped on old IE) |
|---|
| .btn--black / .btn--white | Black or off-white/gray button |
|---|---|
| .btn--classic / .btn--classic-2k | Win95/98-gray or Win2000/XP-beige button |
| .btn--red / .btn--green / .btn--blue / .btn--l-blue / .btn--yellow | Solid color buttons, each with a matching :hover shade |
.btn--tiny .btn--regular .btn--huge
.btn--left .btn--right .btn--default .btn--default-full
.btn--blue .btn--green .btn--red
.btn--yellow .btn--black .btn--white
.btn--classic .btn--classic-y2k
.btn--outline .btn--white .btn--border-classic .btn--classic .btn--border-classic .btn--classic-y2k
.btn--red .btn--nice .btn--red .btn--radius .btn--red .btn--round
<a class="btn btn--regular btn--outline btn--radius btn--nice btn--blue">
Example
</a>
Wrap a set of buttons in .btn-gp to merge their borders into a single strip. Add .btn-gp--radius or .btn-gp--round so only the first and last buttons keep rounded outer corners — mark them with the .first-child / .last-child classes for old IE, since :first-child/:last-child aren't reliable there.
Add .txt-input to any <input> or <textarea> for a classic inset field (2px inset border, darkens slightly on :focus). Same size and shape modifiers as buttons apply.
| .txt--tiny / .txt--regular / .txt--huge | Field size |
|---|---|
| .txt--radius / .txt--round | Rounded corners |
| .txt--nice | Adds a light 1px border with an inset shadow for extra depth |
.txt-input .txt--tiny
.txt-input .txt--regular
.txt-input .txt--huge
.txt-input .txt--regular .txt--nice
.txt-input .txt--regular .txt--radius
.txt-input .txt--round .txt--radius
<input type="text" class="txt-input txt--regular txt--radius txt--nice" />
LegaCSS deliberately skips nav bars, footers, and any JavaScript, so putting a page together is mostly about picking the right containers and reusing the class + modifier system consistently.