N Lorentzen
N Lorentzen

Reputation: 13

How do I add another css to Bootstrap?

I am building a Bootstrap site and have a css (with function to show a sticky note post-it) from another project I want to implement.

When the css is loaded in the index.html, the menu in Bootstrap gets shadow effect from the sticky-css - how do I code the css to only show in ?

The sticky.css file:

@import url(http://fonts.googleapis.com/css?family=Reenie+Beanie);
@import url(http://fonts.googleapis.com/css?family=Patrick+Hand+SC);

.sticky.div:sn {
      margin: 0 auto;
}

.sticky h1,.sticky p{
  font-family:"Reenie Beanie","Ruthie";
  line-height: 100%;
  font-weight:normal;
}

.sticky ul,.sticky li{
  list-style:none;
}
.sticky  ul{
  overflow:hidden;
  padding:2em;
}

.sticky ul li{
  margin:1em;
  float:left;
}

.sticky ul li a{
  text-decoration:none;
  color:#000;
  background:#ffc;
  display:block;
  height:12em;
  width:12em;
  padding:1em;
  -moz-box-shadow:5px 5px 7px rgba(33,33,33,1);
  -webkit-box-shadow: 5px 5px 7px rgba(33,33,33,.7);
  box-shadow: 5px 5px 7px rgba(33,33,33,.7);
  -moz-transition:-moz-transform .15s linear;
  -o-transition:-o-transform .15s linear;
  -webkit-transition:-webkit-transform .15s linear;
  -webkit-transform: rotate(-6deg);
  -o-transform: rotate(-6deg);
  -moz-transform:rotate(-6deg);
}

.sticky ul li h1{
   font-family:"Reenie Beanie","Ruthie";
line-height: 90%;
  font-weight:bold;
  padding-bottom:10px;
}
.sticky ul li p{

  font-size:90%;
}

.sticky ul li:nth-child(even) a{
  -o-transform:rotate(4deg);
  -webkit-transform:rotate(4deg);
  -moz-transform:rotate(4deg);
  position:relative;
  top:5px;
  background:#cfc;
}
.sticky ul li:nth-child(3n) a{
  -o-transform:rotate(-3deg);
  -webkit-transform:rotate(-3deg);
  -moz-transform:rotate(-3deg);
  position:relative;
  top:-5px;
  background:#ccf;
}
.sticky ul li:nth-child(5n) a{
  -o-transform:rotate(5deg);
  -webkit-transform:rotate(5deg);
  -moz-transform:rotate(5deg);
  position:relative;
  top:-10px;
}
.sticky ul li a:hover,ul li a:focus{
  box-shadow:10px 10px 7px rgba(0,0,0,.7);
  -moz-box-shadow:10px 10px 7px rgba(0,0,0,.7);
  -webkit-box-shadow: 10px 10px 7px rgba(0,0,0,.7);
  -webkit-transform: scale(1.25);
  -moz-transform: scale(1.25);
  -o-transform: scale(1.25);
  position:relative;
  z-index:5;
}
.sticky ol{text-align:center;}
.sticky ol li{display:inline;padding-right:1em;}
.sticky ol li a{color:#fff;}

Upvotes: 1

Views: 105

Answers (2)

AndrewL64
AndrewL64

Reputation: 16311

Just add a custom class to your unordered list like this:

<ul class="sticky-thing">
    <li><!--your sticky list items --></li>
    <li><!--your sticky list items --></li>
    <li><!--your sticky list items --></li>
    <li><!--your sticky list items --></li>
</ul>

And then add .sticky-things to all the ul tags in your custom css like this:

ul.sticky-thing li{
  margin:1em;
  float:left;
}
ul.sticky-thing li a{
  text-decoration:none;
  color:#000;
  background:#ffc;
  display:block;
  height:14em;
  width:14em;
  padding:1em;
  -moz-box-shadow:5px 5px 7px rgba(33,33,33,1);
  -webkit-box-shadow: 5px 5px 7px rgba(33,33,33,.7);
  box-shadow: 5px 5px 7px rgba(33,33,33,.7);
  -moz-transition:-moz-transform .15s linear;
  -o-transition:-o-transform .15s linear;
  -webkit-transition:-webkit-transform .15s linear;
  -webkit-transform: rotate(-6deg);
  -o-transform: rotate(-6deg);
  -moz-transform:rotate(-6deg);
}
/* other ul properties */

And your sticky css will be independent from the bootstrap css.

Here's a modified version of your jsfiddle with a dummy bootstrap navbar (menu) added along with the above codes: http://jsfiddle.net/AndrewL32/e15hfqg1/2/

Upvotes: 0

Kevin Ard
Kevin Ard

Reputation: 604

Are you using third-party addons for bootstrap. I know of several that use the .sticky class, so there would certainly be a conflict there.

Can you rename your styles to something like .sticky-note?

Upvotes: 2

Related Questions