aboutsummaryrefslogtreecommitdiff
path: root/lib/patterns.less
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2011-08-26 20:38:23 -0700
committerMark Otto <[email protected]>2011-08-26 20:38:23 -0700
commit4f67e135dc2a8ad7a7b3d8946cc7a857a34881a0 (patch)
tree42faa86f8b0fd63558f9465fe5cc2328a2e6ed49 /lib/patterns.less
parentb9c9f1d8d616bece3240aa8c3c78873947c7d88f (diff)
downloadbootstrap-4f67e135dc2a8ad7a7b3d8946cc7a857a34881a0.tar.xz
bootstrap-4f67e135dc2a8ad7a7b3d8946cc7a857a34881a0.zip
adding dropdowns to tabs by refactoring the shizzzz out of them
Diffstat (limited to 'lib/patterns.less')
-rw-r--r--lib/patterns.less398
1 files changed, 196 insertions, 202 deletions
diff --git a/lib/patterns.less b/lib/patterns.less
index d0e4cda12..f5ca099cb 100644
--- a/lib/patterns.less
+++ b/lib/patterns.less
@@ -17,8 +17,8 @@
overflow: visible;
// gradient is applied to it's own element because overflow visible is not honored by ie when filter is present
- .fill {
- background:#222;
+ .wrapper {
+ background-color: #222;
#gradient > .vertical(#333, #222);
@shadow: 0 1px 3px rgba(0,0,0,.25), inset 0 -1px 0 rgba(0,0,0,.1);
.box-shadow(@shadow);
@@ -100,151 +100,213 @@
}
}
}
+}
- // Navigation
- ul {
+
+// NAVIGATION
+// ----------
+// ul.nav for all topbar based navigation to avoid inheritance issues and over-specificity
+.nav {
+ display: block;
+ float: left;
+ margin: 0 10px 0 0;
+ position: relative;
+ left: 0;
+ &.secondary-nav {
+ float: right;
+ margin-left: 10px;
+ margin-right: 0;
+ }
+ li {
display: block;
float: left;
- margin: 0 10px 0 0;
- position: relative;
- &.secondary-nav {
- float: right;
- margin-left: 10px;
- margin-right: 0;
- }
- li {
+ font-size: 13px;
+ a {
display: block;
- float: left;
- font-size: 13px;
- a {
- display: block;
- float: none;
- padding: 10px 10px 11px;
- line-height: 19px;
+ float: none;
+ padding: 10px 10px 11px;
+ line-height: 19px;
+ text-decoration: none;
+ &:hover {
+ color: #fff;
text-decoration: none;
- &:hover {
- color: #fff;
- text-decoration: none;
- }
- }
- &.active a {
- background-color: #222;
- background-color: rgba(0,0,0,.5);
}
}
+ &.active a {
+ background-color: #222;
+ background-color: rgba(0,0,0,.5);
+ }
+ }
- // Dropdowns
- &.primary-nav li ul {
- left: 0;
+ // Dropdowns within the .nav
+ &.secondary-nav li .dropdown-menu {
+ right: 0;
+ }
+}
+
+// Dropdown Menus
+// Use the .menu class on any <li> element within the topbar or ul.tabs and you'll get some superfancy dropdowns
+.dropdown {
+ position: relative;
+}
+// The link that is clicked to toggle the dropdown
+.dropdown-toggle:after {
+ width: 0;
+ height: 0;
+ display: inline-block;
+ content: "&darr;";
+ text-indent: -99999px;
+ vertical-align: top;
+ margin-top: 8px;
+ margin-left: 4px;
+ border-left: 4px solid transparent;
+ border-right: 4px solid transparent;
+ border-top: 4px solid #fff;
+ .opacity(50);
+}
+// The dropdown menu (ul)
+.dropdown-menu {
+ background-color: #fff;
+ float: left;
+ display: none; // None by default, but block on "open" of the menu
+ position: absolute;
+ top: 40px;
+ min-width: 160px;
+ max-width: 220px;
+ _width: 160px;
+ margin-left: 0; // override default ul styles
+ margin-right: 0;
+ padding: 6px 0;
+ zoom: 1; // do we need this?
+ border-color: #999;
+ border-color: rgba(0,0,0,.2);
+ border-style: solid;
+ border-width: 0 1px 1px;
+ .border-radius(0 0 6px 6px);
+ .box-shadow(0 2px 4px rgba(0,0,0,.2));
+ .background-clip(padding-box);
+
+ // Unfloat any li's to make them stack
+ li {
+ float: none;
+ display: block;
+ background-color: none;
+ // Links within the dropdown menu
+ a {
+ display: block;
+ padding: 4px 15px;
+ clear: both;
+ font-weight: normal;
+ line-height: 18px;
+ color: @gray;
+ text-shadow: 0 1px 0 #fff;
+ // Hover state
+ &:hover {
+ #gradient > .vertical(#eeeeee, #dddddd);
+ color: @grayDark;
+ text-decoration: none;
+ @shadow: inset 0 1px 0 rgba(0,0,0,.025), inset 0 -1px rgba(0,0,0,.025);
+ .box-shadow(@shadow);
+ }
}
- &.secondary-nav li ul {
- right: 0;
+ // Dividers (basically an hr) within the dropdown
+ &.divider {
+ height: 1px;
+ margin: 5px 0;
+ overflow: hidden;
+ background-color: #eee;
+ border-bottom: 1px solid #fff;
}
- li.menu {
- position: relative;
- a.menu {
- &:after {
- width: 0px;
- height: 0px;
- display: inline-block;
- content: "&darr;";
- text-indent: -99999px;
- vertical-align: top;
- margin-top: 8px;
- margin-left: 4px;
- border-left: 4px solid transparent;
- border-right: 4px solid transparent;
- border-top: 4px solid #fff;
- .opacity(50);
- }
- }
- &.open {
- a.menu,
- a:hover {
- background-color: #444;
- background-color: rgba(255,255,255,.1);
- *background-color: #444; /* IE6-7 */
- color: #fff;
- }
- ul {
- display: block;
- li {
- a {
- background-color: transparent;
- font-weight: normal;
- &:hover {
- background-color: rgba(255,255,255,.1);
- *background-color: #444; /* IE6-7 */
- color: #fff;
- }
- }
- &.active a {
- background-color: rgba(255,255,255,.1);
- font-weight: bold;
- }
- }
- }
+ }
+}
+// Open state for the dropdown
+.dropdown.open {
+ .dropdown-toggle {
+ color: #fff;
+ background-color: rgba(0,0,0,.3);
+ }
+ .dropdown-menu {
+ display: block;
+ }
+}
+
+// Tabs and Pills
+.tabs,
+.pills {
+ margin: 0 0 20px;
+ padding: 0;
+ list-style: none;
+ .clearfix();
+ > li {
+ float: left;
+ > a {
+ display: block;
+ }
+ }
+}
+
+// Basic Tabs
+.tabs {
+ width: 100%;
+ border-bottom: 1px solid #ddd;
+ > li {
+ position: relative; // For the dropdowns mostly
+ > a {
+ margin-bottom: -1px;
+ margin-right: 2px;
+ padding: 0 15px;
+ line-height: (@baseline * 2) - 1;
+ .border-radius(4px 4px 0 0);
+ &:hover {
+ background-color: #eee;
+ border-bottom: 1px solid #ddd;
+ text-decoration: none;
}
}
- li ul {
- background-color: #333;
- float: left;
- display: none;
- position: absolute;
- top: 40px;
- min-width: 160px;
- max-width: 220px;
- _width: 160px;
- margin-left: 0;
- margin-right: 0;
- padding: 0;
- text-align: left;
- border: 0;
- zoom: 1;
- .border-radius(0 0 5px 5px);
- .box-shadow(0 1px 2px rgba(0,0,0,0.6));
- li {
- float: none;
- clear: both;
- display: block;
- background: none;
- font-size: 12px;
- a {
- display: block;
- padding: 6px 15px;
- clear: both;
- font-weight: normal;
- line-height: 19px;
- color: #bbb;
- &:hover {
- background-color: #333;
- background-color: rgba(255,255,255,.25);
- color: #fff;
- }
- }
-
- // Dividers (basically an hr)
- &.divider {
- height: 1px;
- overflow: hidden;
- background: #222;
- background: rgba(0,0,0,.2);
- border-bottom: 1px solid rgba(255,255,255,.1);
- margin: 5px 0;
- }
-
- // Section separaters
- span {
- clear: both;
- display: block;
- background: rgba(0,0,0,.2);
- padding: 6px 15px;
- cursor: default;
- color: @gray;
- border-top: 1px solid rgba(0,0,0,.2);
- }
+ &.active > a {
+ background-color: #fff;
+ padding: 0 14px;
+ border: 1px solid #ddd;
+ border-bottom: 0;
+ color: @gray;
+ }
+ }
+ .dropdown-menu {
+ top: 35px;
+ border-width: 1px;
+ .border-radius(0 6px 6px 6px);
+ }
+ .dropdown-toggle:after {
+ border-top-color: #999;
+ margin-top: 15px;
+ margin-left: 5px;
+ }
+ .dropdown.open .dropdown-toggle:after {
+ border-top-color: #555;
+ }
+}
+
+// Basic pill nav
+.pills {
+ li {
+ a {
+ margin: 5px 3px 5px 0;
+ padding: 0 15px;
+ text-shadow: 0 1px 1px #fff;
+ line-height: 30px;
+ .border-radius(15px);
+ &:hover {
+ background: @linkColorHover;
+ color: #fff;
+ text-decoration: none;
+ text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
}
+ &.active a {
+ background: @linkColor;
+ color: #fff;
+ text-shadow: 0 1px 1px rgba(0,0,0,.25);
+ }
}
}
@@ -450,74 +512,6 @@ input[type=submit].btn {
}
}
-// NAVIGATION
-// ----------
-
-// Common tab and pill styles
-.tabs,
-.pills {
- margin: 0 0 20px;
- padding: 0;
- .clearfix();
- li {
- display: inline;
- a {
- float: left;
- width: auto;
- }
- }
-}
-
-// Basic Tabs
-.tabs {
- width: 100%;
- border-bottom: 1px solid @grayLight;
- li {
- a {
- margin-bottom: -1px;
- margin-right: 2px;
- padding: 0 15px;
- line-height: (@baseline * 2) - 1;
- .border-radius(3px 3px 0 0);
- &:hover {
- background-color: @grayLighter;
- border-bottom: 1px solid @grayLight;
- }
- }
- &.active a {
- background-color: #fff;
- padding: 0 14px;
- border: 1px solid #ccc;
- border-bottom: 0;
- color: @gray;
- }
- }
-}
-
-// Basic pill nav
-.pills {
- li {
- a {
- margin: 5px 3px 5px 0;
- padding: 0 15px;
- text-shadow: 0 1px 1px #fff;
- line-height: 30px;
- .border-radius(15px);
- &:hover {
- background: @linkColorHover;
- color: #fff;
- text-decoration: none;
- text-shadow: 0 1px 1px rgba(0,0,0,.25);
- }
- }
- &.active a {
- background: @linkColor;
- color: #fff;
- text-shadow: 0 1px 1px rgba(0,0,0,.25);
- }
- }
-}
-
// PAGINATION
// ----------
@@ -748,4 +742,4 @@ input[type=submit].btn {
margin-bottom: 0;
}
}
-}
+} \ No newline at end of file