Giter Site home page Giter Site logo

cardinalcss / cardinalcss Goto Github PK

View Code? Open in Web Editor NEW
717.0 42.0 75.0 1.68 MB

A modular, “mobile-first” CSS framework built with performance and scalability in mind.

Home Page: http://cardinalcss.com

License: MIT License

CSS 79.02% JavaScript 0.86% HTML 20.12%
css css-framework

cardinalcss's Introduction

Cardinal

npm version Bower version

Build more with less.

⚠️ THIS REPO IS NO LONGER BEING ACTIVELY MAINTAINED. USE AT YOUR OWN RISK! ⚠️

Table of Contents

What is Cardinal?

Cardinal is a modular, “mobile-first” CSS framework built with performance and scalability in mind.

The purpose of this framework is to make it easier for front-end web developers to prototype, build, scale, and maintain CSS for responsive websites, user interfaces, and applications. Cardinal omits many aesthetic design decisions that often bog down other CSS frameworks (which are often UI toolkits, not frameworks), leaving the design and creativity up to you.

Features

  • “Mobile-first” CSS written for the LESS preprocessor
  • normalize.css
  • Sensible global styles, variables, and useful mixins
  • A flexible grid system and encapsulated styles for common UI objects (buttons, forms, tables, etc.)
  • A collection of utility classes optimized for great gzip compression
  • The entire framework, minified and gzipped, clocks in at a mere 11.27kB

Dependencies

If you would like to install Cardinal with the Bower package manager tool, you will first need to install Node.js on your machine or server. Once you have Node.js installed, make sure npm is installed (info here), and use it to install Bower, like so:

npm install -g bower

Also, Cardinal depends on the awesome tool Autoprefixer, which adds the proper vendor prefixes that provide the specified browser support for this project. This way, you don’t have to worry about manually including the correct prefixes while writing LESS/CSS. You are encouraged to incorporate Autoprefixer into your build process (this is easy to do with tools like Grunt or Gulp).

Getting Started

There are several ways that you can use Cardinal in your new and existing web projects.

Package Managers

The fastest way to get up-and-running with Cardinal is by using a package manager, like so:

Bower

To install Cardinal with Bower, run the following command(s) from your terminal:

cd your-project-directory
bower install --save cardinal

Once installed, you can find Cardinal here:

your-project-directory
│
└───bower_components
    │
    └───cardinal

npm

To install Cardinal with npm, run the following command(s) from your terminal:

cd your-project-directory
npm install --save cardinalcss

Once installed, you can find Cardinal here:

your-project-directory
│
└───node_modules
    │
    └───cardinalcss

Updating Cardinal

You can grab the latest version of Cardinal by running the following command(s):

Bower

bower update cardinal

npm

npm update cardinal

LESS Plugin

There is also a LESS.js plugin available for Cardinal, created and maintained by @bassjobsen. You can use this plugin to include Cardinal in your project before your custom project code.

Installation

npm install less
npm install less-plugin-cardinal

Usage

lessc custom.less --cardinal

Direct Download

If you do not want to use a package manager to integrate Cardinal into your project, you can also download it directly:

Build from Source

To do so, you need to already have Node.js and npm installed on your machine. Cardinal uses Gulp to build and watch the CSS files.

git clone [email protected]:cbracco/cardinal.git
cd cardinal
npm install
gulp

Download the Zip

You can also download the .zip file and proceed however you wish. Include the minified CSS file in the <head> of your project, or modify the LESS files directly (not recommended, since it will be difficult to update to future versions). It’s your world!

Customizing

Including Partials

The easiest way to include Cardinal in your project is to include the entire thing before your project files, like so:

//
// Vendor
//

@import url("../../path/to/bower_components/cardinal/cardinal.less");

//
// Project
//

@import url("project-file.less");

However, you don’t have to use the entire Cardinal framework. The only required partials are located in the base/ directory:

//
// Vendor
//

//
// Base
//
// These variables, mixins, and styles are required if you want to use this
// framework, and they should be included in the following order.
//

// Base -> Variables

@import url("base/variables.less");

// Base -> Mixins

@import url("base/mixins/to-rem.less");
@import url("base/mixins/media-queries.less");
@import url("base/mixins/antialiasing.less");
@import url("base/mixins/clearing.less");
@import url("base/mixins/font-face.less");
@import url("base/mixins/momentum-scrolling.less");
@import url("base/mixins/text-truncate.less");
@import url("base/mixins/vertically-centered.less");

// Base -> Normalize

@import url("base/normalize.less");

// Base -> Reset

@import url("base/reset.less");

// Base -> Debug (DO NOT USE THIS STYLESHEET IN PRODUCTION!)

//@import url("base/debug.less");

// Base -> Default Styles

@import url("base/root.less");
@import url("base/anchors.less");
@import url("base/text-elements.less");
@import url("base/headings.less");
@import url("base/lists.less");
@import url("base/horizontal-rules.less");
@import url("base/blockquotes.less");
@import url("base/code.less");
@import url("base/embedded-content.less");
@import url("base/form-elements.less");
@import url("base/tables.less");
@import url("base/print.less");

Beyond that, you can use whatever grid system, components, and utilities you would like. The base/ directory just sets some good base styles for the framework.

Modifying Variables

After getting started and including Cardinal, you will probably want to begin customizing it to suit your project. Cardinal has a bunch of LESS variables located in the base/variables.less file that can be tweaked to your needs. These variables should not be edited directly. The recommended way to make changes to Cardinal LESS variables is to create your own project-specific variables file (e.g. project-variables.less), and override the default variables in this file, like so:

// project-variables.less

// Typography -> Font Sizes -> Base

$font-size: 17;

//
// Typography -> Line height
//

$line-height: 26;

This file should be included in your main LESS file after you’ve included Cardinal.

Further Documentation

There is a README.md file included in each major directory of this project that further details the code located in those directories.

Browser support

Cardinal supports most modern browsers:

  • Google Chrome 25+
  • Mozilla Firefox 19+
  • Safari 6.0+
  • iOS Safari 6.0+
  • Opera 12.1+
  • Android 4.2+
  • Internet Explorer 9+

Contributing

Is something broken? Do you have ideas or feature requests? Please submit an issue here on GitHub. Or, if you are feeling especially motivated, write some code and submit a pull request!

IMPORTANT: Before doing a bunch of work, please consult the CONTRIBUTING.md document, which gives detailed instructions on how to contribute to this project. If you do not follow the instructions, your code will probably not make it into this project.

Versioning

Cardinal will be maintained using the Semantic Versioning guidelines. From here on out, releases will be numbered using the following format:

major.minor.patch

  • Breaking backwards compatibility increments major, while resetting minor and patch.
  • New code that does not break backwards compatibility increments minor, while resetting patch.
  • Bug fixes and other small changes increment patch.

Credits

Cardinal is a project by @cbracco. Its principles and techniques are very influenced by the following projects, organizations, and individuals:

...and any others I may have forgotten — let me know if I have, and I will certainly add them.

Many thanks for your hard work and great ideas!

License

Cardinal is licensed under the MIT Open Source license. For more information, see the LICENSE.md file in this repository.

cardinalcss's People

Contributors

bassjobsen avatar cbracco avatar johnogram avatar lukechilds avatar progsource avatar vladootz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cardinalcss's Issues

Have class for input styling

I'd like to style an arbitrary div to look like an input, but actually have two unstyled inputs within it. It'd be nice if you guys had a class that one could apply to style any element.

Also, would a PR for this feature be welcome?

Re-organize LESS partials

I don't like the current setup. Simplify!

New organization:

less/
│
└───base/
    │
    └───mixins/
│
└───components/
│
└───layout/
│
└───utilities/

body and heading font-stack

Is there any particular reason the body font is set to:
font-family: "Helvetica Neue", Arial, sans-serif;

and the heading stack to:
font-family: "Helvetica Neue", sans-serif;

(note the absence of Arial for headings)

More Documentation

Documentation is pretty weak at the moment. Will attempt to make steady progress here.

font-sizes should appear after all specific font-sizes in the document

Currently font-sizes are defined early in the stylesheet : .text_medium { font-size: 1.333rem; }. After that, some class-specific font-sizes are defined, for example: .grid-item { ...; font-size: 1rem; }.

With the stylesheet ordered this way, adding a .text_medium class to the grid-item is ineffective : <div class="grid-item text_medium"> has text with a font-size set to 1rem instead of 1.333rem, like one would expect.

I suggest moving font-size declarations after all other specific font-sizes. I would have also name those classes font_..., because they are font-property modifiers.

Class-naming conventions

I'm not sure whether chaining (eg. .button.chunky) or block/element-specific modifiers (eg. .button_chunky) is a better, more scalable approach... thoughts, anyone?

Suggestions for Cardinal 2.0.0

I'm currently working on 2.0.0, which be a fairly large update from the current version 1.4.0. I'd like to delete a bunch of stuff that I have not really been using (some helper classes, in particular), simplify naming conventions (hyphens on all the things), remove the @media queries that resize your entire project (instead favoring a base font size of 16px across devices), using EMs instead of REMs for browser compatibility, and much more.

Anyone, pelase feel free to chime in with any ideas, feature requests, or complaints. Any feedback is greatly appreciated. Thanks!

Define 'mobile-first'

The inclusion of max-width based media queries seems to violate the concepts behind mobile-first css architecture. I'm curious as to how this architecture is considered to be mobile-first?

Suggestions

Hello Chris,

Nice work here. I just would like to share two snippets (I don't think they 'deserve' to be treated as a submit, since it's more like i'm sharing some thoughts here. Any case, please let me know if this is not the right place).

  1. You could extend your word-wrap: break-word to more elements that usually have this kind of problem.
p,
div, 
textarea, 
table, 
td, 
th, 
code, 
pre, 
samp {
  -webkit-hyphens: auto;
  -moz-hyphens:    auto;
  -ms-hyphens:     auto;
  hyphens:         auto;
  word-wrap: break-word;
 }
  1. I see myself constantly eliminating the top margin of my first elements on the content. So, this code is something that I always have around.
p:first-child,
ul:first-child,
ol:first-child,
dl:first-child,
blockquote:first-child,
pre:first-child,
h1:first-child,
h2:first-child,
h3:first-child,
h4:first-child,
h5:first-child,
h6:first-child {
margin-top: 0;
}

Cheers

Re-organize gulp tasks & handle errors

Consider creating a gulp folder to house the various tasks used in this project. Also, consider adding better error handling so that watch streams are not interuppted when errors occur.

Add demos to documentation

Now that we have a basic shell of documentation, it would be nice to include demo links, because "demo or it didn't happen". Create a Codepen collection for demos!

Grid gutter size typo

Hey Chris,

I think there is a typo on the grid gutter sizes:

.grid-gutter-half              { margin-left: -1rem; }
.grid-gutter-half .grid-item   { padding-left: 1rem; }
.grid-gutter-double            { margin-left: -4rem; }
.grid-gutter-double .grid-item { padding-left: 4rem; }

Don't you mean 2rem? Now if it is half or double, is up to you ;-)

Cheers,
Daniel

Examples of Cardinal out the wild?

Here is the place to share any links to Cardinal being used on production websites. If you know of any, or have made any yourself, please share them here!

Thanks!

😈 Chris

Why don't headings simply inherit font-family?

Hi,

I searched in the issues if this question had already been asked and I couldn't find any answer. Why is there a specifically defined font-family for headings? Can't it simply be set to inherit?

.button-small uses not existing medium sizes

.button-small {
    padding: @button-medium-padding;
    font-size: @button-medium-font-size;
}

should be

.button-small {
    padding: @button-small-padding;
    font-size: @button-small-font-size;
}

I guess

Embedded YouTube videos

Nice to see basic styling for embedded content, but the iframe option isn't particularly useful for YouTube/Vimeo videos. You'd think they'd have figured a way to do this via their own embed method by now, but until they do I'd suggest adding a helper class:

.youtube {
  position: relative;
  padding-bottom: 56.25%;
  height: 0; overflow: hidden;
  max-width: 100%;
}
.youtube iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

Only tested on a couple of browsers, but works well without the need for js — source: http://embedresponsively.com

Increase .wrapper width to match more factors.

The issue #13 made me think about an old question that I once asked here http://math.stackexchange.com/questions/295407/which-number-has-the-highest-divisibility-factors

The current set up for the .wrapper class gives a 1026px wide element. Which has 16 factors.

.wrapper {
margin: 0 auto;
max-width: 1140px;
width: 90%;
}

What if you increase the max-width a bit:

.wrapper {
margin: 0 auto;
max-width: 1200px;
width: 90%;
}

That would give us a 1080px wide element, which has 32 factors. That way we have a higher flexibility to work more precisely with the grid.

Double scroll bars

Hey Chris,

Cardinal 1.0 gave me double scroll bars.
by default 2013-08-24 at 3 49 58 pm

I fixed that changing min-height: 100% to height: 100% at:

html,
body {
min-height: 100%;
overflow-x: hidden; /* 2 */
}

Can you duplicate this issue?

PSD for the grid

Hey Chris,

Do you have any .psd that would match the Cardinal grid system? It would be useful for mockups.

Layout - grid only works with gutter set to zero when using LESS

Hello, great framework!
I've got an issue with using LESS. If I use the normal main.css all works fine, if I compile with LESS, the grid doesn't work properly, unless I set the @grid-gutter variable to zero.
Somehow, the grid elements render to wide ...
Thanx, Regards

Making Cardinal IE8 Ready

If I wanted to make Cardinal IE8 Ready, do you think the following set up would work?

Media Query Support: Respond.js - https://github.com/scottjehl/Respond
Box-SIzing - Schepp Box SIzing Polyfil - https://github.com/Schepp/box-sizing-polyfil
REM Units - REM Unit Polyfill - https://github.com/chuckcarpenter/REM-unit-polyfill

And Moderizr of course for sniffing out IE8. Thoughts? What about about packaging these in so we can use IE8. I still consider IE8 as a browser that needs to work for a production project.

More IE8 left over

Hey Chris,

I think we don't need this code too.

/* Remove black outlines on <input> buttons in IE7. */
input[type="button"], 
input[type="reset"],
input[type="submit"] {
filter: chroma(color=#000000);
}

header fixed to top

Hi,

Is there an easy way to fix the header to the top of the page?

I tried inline style:

style="position:fixed; "

I tried giving the header an id and adding to the main CSS:

#header { position:fixed; }

I tried giving the header an id and adding extra style to the HTML:

<style>
#header {
    position:fixed;
}
</style>

None of these efforts worked! I note none of the wild sites have a fixed header - is it really difficult?

Kind Regards

Gavin

+ selector in objects/forms.less

Hello, I might be wrong - maybe it's because I work with grunt still - but the "+" selectors in objects/forms.less seem out of place to me?
line 9 .form-label + .form-input for example

line 1952 cardinal.css
.form-label + .form-input

is not a proper selector?
it doesn't work @ my end ...

I changed it to:
.form-label,
.form-input,
.form-select,
.form-textarea {
.to-rem(margin-top, @form-label-margin);
}

to make it work?

Use em instead of rem in typography

e.g.
when using the "small" element in a header the size difference should be relative
when using rem for this it's just don't fit,
that's my opinion - feel free to comment
never mind - old version

SASS, LESS, and Stylus versions of Cardinal

I've created this issue as a place to talk about LESS and SASS versions of Cardinal. I recently deleted the wip-0.4.0 branch of Cardinal because I wanted to re-work it, but in doing so GitHub declined and closed a previous issue and pull request on this very topic.

@muhas has already begun working on a LESS version, and @ericdfields has expressed interest in writing a SASS version.

If anyone else is interested in helping, please speak up here! Simply fork Cardinal and create your version.

Thanks all for your interest and help!

Multiple conflicting CSS versions going forward

Because of the recent implementation of LESS in the project to modularize the CSS, I'm unsure that there needs to be two versions of the main project styles in the CSS folder when the grunt build is run.

Right now the build process creates two CSS files that are non-minified and minified named cardinal.css and cardinal.min.css. This is in addition to the main.css file which has resided in the project CSS folder for awhile now. We could remove the main.css to have the build process generated the output from here on, but of course this is up for discussion. Thoughs?

Re-organize repo & Bower includes

Consider re-organizing the repo in a similar fashion to jQuery (a dist/ folder for build CSS & sourcemap files that does not get committed to the repo, but is available when downloaded with package managers).

Also, consider slimming down which files get sent to Bower (currently the entire repo gets sent).

Grid naming conventions and flexibility

I really like the look of this framework, especially as (ignoring the IE8 issues) the font sizing is succinct and easy to manage. The one thing that at this point which might stop me from using the framework is the grid system is:

  • A little verbose
  • Not flexible enough

Granted we could add .one_seventh .one_eighth etc, but I'd much prefer to use the standard 12/16/24 column grid, of which Frameless is quite a good example (although a different way of working), or Kube's percentage style which is similar to Bootstrap, and really clear to understand.

With Less you could create this grid with a lot less code I expect, with the added benefit of being able to use pure CSS to use the grid (via mixins).

Although I agree with you on Bootstrap being way too heavy, their upcoming grid system is similar, more flexible, and easier to understand at-a-glance.

Perhaps utilising an existing grid, along with the rem gutters?

Grid nesting

If I'm nesting the grid with different gutter sizes, the children grid-items respect the first grid gutter, not their parent's (eg if gutter-double contains gutter-whole or gutter-none and if gutter-whole contains gutter-none).
Codepen example.

Safari < 6, Android < 4.2 grid bug

There's a browser bug in safari with the grid system. Check out hazel.bigroomstudios.com in safari and firefox (older versions of chrome also seem to be effected).

grid_incorrect
grid_correct

Add MIT license

As i noticed, the license text is MIT, however, for including in other open source projects, lets say WordPress (gpl) the license must be named and officially known (you can have your homerolled version, but that would hold users back).

Anyway, Keep up the good work!

Remove support for old IE

Hey Chris,

There are some pieces of code in Cardinal that are exclusive for IE6/7/8. IMHO they shouldn't exist, since they are redundant.

In my logic, the simple fact of using media queries already make Cardinal IE9+. And to ratify that, the whole framework is based on REM, another IE9+ feature :-)

Just my two cents.

Text Rendering Improvement

I usually add the following to the normalize reset for better text rendering.

html, body {
-webkit-font-smoothing: antialiased;
}

Fixing only grid-item instance

Hey Chris,

I when I was using the grid on a page I noticed that the grid-item was messing with my design. Mostly because there was only one grid-item on that page. So, to fix that I came out with this code.

 /** 
  * Remove the bottom margin on the last element inside each `.grid_item` 
  * and if there is no siblings of the given type.
  */
 .grid-item > *:last-child,
 .grid-item:only-of-type {
    margin-bottom: 0;
 }

Just my two cents :-)

Switch Cardinal back to em/px units for 3.0 release

I think I want to do this, so that IE < 9 compatibility is a bit easier for folks not using preprocessors to automate pixel fallbacks. Any objections / glaring reasons why this should not be done? Speak up now!

A layer between normalize and cardinal?

Hi I was looking over a few css frameworks and noticed the same stuff being repeated:

/* Set box model to include the padding and the border. */
*, *:before, *:after {
    box-sizing: border-box;
}

/* Don't jump on x axis when y overflows due to insertion of scroll bar. */
html {
    overflow-y: scroll
}

/* NON-STANDARD: Make selected text more legible. */
::selection {
    text-shadow: none;
}

textarea {
    resize: vertical
}

/* Remove line-height gap at bottom of containers. */
audio, canvas, img, svg, video {
    vertical-align: middle;
}

I was planning on splitting it out, there probably is some more fixes that could go in it as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.