Skip to content

cssobj/cssobj-intro-clearfix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cssobj-intro-clearfix

Join the chat at https://gitter.im/css-in-js/cssobj

cssobj intro to make clearfix easier. code from The very latest clearfix reloaded

Install

  • npm
npm install cssobj-intro-clearfix
  • bower
bower install cssobj-intro-clearfix

Usage

  • basic usage:

When you need to put '<div class="clearfix nav">', but don't remember the clearfix hack, or don't want to copy/paste, use this plugin as below:

var clearfix = require('cssobj-intro-clearfix')

cssobj(
  { '.nav': {color: 'red'} },
  {
    intros: [
      clearfix()
    ]
  }
)

result css:

.clearfix:before,
.clearfix:after {
    content: " ";
    display: table;
}
.clearfix:after {
    clear: both;
}
.clearfix {
    *zoom: 1;
}
.nav {
    color: red;
}

So your html can be as clean as: '<div class="nav">', no need to write clearfix in your tag.

var clearfix = require('cssobj-intro-clearfix')
var pluginExtend = require('cssobj-plugin-extend')

cssobj(
  { '.nav': {color: 'red', $extend: /\.clearfix\b/} },
  {
    intros: [
      clearfix()
    ],
    plugins: [
      pluginExtend()
    ]
  }
)

result css:

.clearfix:before,
.clearfix:after,
.nav:before,
.nav:after {
    content: " ";
    display: table;
}
.clearfix:after,
.nav:after {
    clear: both;
}
.clearfix,
.nav {
    *zoom: 1;
}
.nav {
    color: red;
}

Option

option.className [string] (default: 'clearfix')

Class name for the clearfix, should without dot

option.useBlock [boolean] (default: false)

Whether use display: block instead of display: table

see: the different

option.oldIE [boolean] (default: false)

Whether support oldIE (IE 6,7), by adding *zoom: 1; to container.

About

cssobj intro to make css clearfix easier

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors