Giter Club home page Giter Club logo

bootstrap-sandbox's Introduction

TWITTER BOOTSTRAP - SANDBOXED

Bootstrap is Twitter's toolkit for kickstarting CSS for websites, apps, and more. It includes base CSS styles for typography, forms, buttons, tables, grids, navigation, alerts, and more.

The main repo is here: http://github.com/twitter/bootstrap

And the example page is here: http://twitter.github.com/bootstrap

This Sandbox Version

Sometimes you're stuck using someone else's css on a page, but you do have control over your div -- if only you could bring in twitter-bootstrap to style your widget, and not break everything else along with it. You can with this sandboxed version!

This fork allows you to break free of the css world you're in now, and create a little sandbox on your page where you can use twitter bootstrap without clobbering all the other styles AND without having the other styles clobber your little twitter-bootstrap world.

The Big Assumption

To sandbox, I've used the trick of overspecifying every style. I've chosen to prepend every style with two id tokens (#t #b). This will keep the sandboxed twitter-bootstrap from affecting the outer css world ONLY if that world has specificity less than or equal to the sandboxed styles. To say it another way, you will be safe if the pre-existing css on the page never uses more than 1 id token in its css declarations. You're probably still safe if it uses 2 id tokens in a single css declaration, except in rare cases. If you have any stylings using 3, then this might not work so well.

Usage

All of the twitter-bootstrap styles have been sandboxed by prepending them with #t #b, so to take advantage, you'll need to wrap your widget in html like this:

<div id="t">
  <div id="b">
    ha ha rest-of-this-html-page, I can do twitter bootstrap stuff here and you can't
  </div>
</div>

And of course you'll need to inlcude a link to the css, you'll probably wanna add it to the end of your css link list, so it retains maximum specificity.

<link rel="stylesheet/less" type="text/css" href="bootstrap-sandbox.css" />

For any custom styles you want inside the sandbox, you'll find that you often need to prepend them with #t #b to make them specific enough to catch -- it depends on the style. It's probably good habit to just do this for everything so you don't waste time figuring it all out.

Relevant Changes from Bootstrap

  1. rewrite all root level specifications (html & body) to use "#t #b"

  2. prepend all other specifications with "#t #b"

  3. remove the scrollbar in reset.less on #t #b

bootstrap-sandbox's People

Contributors

caniszczyk avatar cheeaun avatar daniel-liuzzi avatar dhs avatar fat avatar igorbozato avatar karthikv avatar matthewpennell avatar mdo avatar nickveys avatar pthrasher avatar rafbm avatar sankage avatar soffes avatar tigraine avatar weslly avatar workwithnano avatar yury avatar

Watchers

 avatar

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.