From be8fa5e7906a6d223850a695703d2669baafbb7e Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Fri, 25 Nov 2016 17:14:36 -0800 Subject: [PATCH 1/2] Add some flexbox nav components - Includes .nav-justified for inline, tab, and pill nav components - Includes example of using the flex utils (.d- and .flex-items-) for centered nav --- docs/components/navs.md | 86 +++++++++++++++++++++++++++++++++++++++++ scss/_nav.scss | 22 +++++++++++ 2 files changed, 108 insertions(+) diff --git a/docs/components/navs.md b/docs/components/navs.md index 2b76f36e3c3d..de49ccb53fd4 100644 --- a/docs/components/navs.md +++ b/docs/components/navs.md @@ -210,6 +210,92 @@ Add dropdown menus with a little extra HTML and the [dropdowns JavaScript plugin {% endexample %} +## Flexbox variations + +When in [flexbox mode]({{ site.baseurl }}/getting-started/flexbox/), tabbed and pilled navigation components gain access to additional nav styles. **These aren't available in default Bootstrap** due to a bug in table styles and responsive behavior. + +### Justified nav + +Create equal-width links in a navigation component by adding `.nav-justified` to a `.nav` component. This works with the inline, tab, and pill variants. + +Using the inline nav: + +{% example html %} + +{% endexample %} + +You can also use it on tabs: + +{% example html %} + +{% endexample %} + +And pills, too: + +{% example html %} + +{% endexample %} + +### Centered nav + +Using our [flexbox utilities]({{ site.baseurl }}/layout/flexbox-grid/#horizontal-alignment), you can also customize your navigation components to change the alignment of nav items. For example, here are center aligned links on the inline nav component. + +{% example html %} + +{% endexample %} + ## JavaScript behavior Use the tab JavaScript plugin—include it individually or through the compiled `bootstrap.js` file—to extend our navigational tabs and pills to create tabbable panes of local content, even via dropdown menus. diff --git a/scss/_nav.scss b/scss/_nav.scss index 640956ca2f16..0f635e794e01 100644 --- a/scss/_nav.scss +++ b/scss/_nav.scss @@ -155,3 +155,25 @@ display: block; } } + + +// Justified navigation (flexbox only) +// +// Justified nav components are only built for flexbox mode in Bootstrap 4. In +// previous versions, this component variation was limited to anchor-based nav +// implementations--meaning it couldn't be used on button elements. This is due +// to a longstanding Safari bug in responsive table styles. +// +// Using flexbox, we avoid that problem altogether at the cost of no default +// justified navigation for default Bootstrap. Sorry, y'all <3. + +@if $enable-flex { + .nav-justified { + display: flex; + + .nav-item { + flex: 1; + text-align: center; + } + } +} From 7cec5580ee0d54860b59d888876365a57af76f8b Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Fri, 25 Nov 2016 17:14:52 -0800 Subject: [PATCH 2/2] redo heading hierarchy a bit --- docs/components/navs.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/components/navs.md b/docs/components/navs.md index de49ccb53fd4..86fd0463fc6b 100644 --- a/docs/components/navs.md +++ b/docs/components/navs.md @@ -16,7 +16,9 @@ Navigation available in Bootstrap share general markup and styles, from the base If you are using navs to provide a navigation bar, be sure to add a `role="navigation"` to the most logical parent container of the ` {% endexample %} -## Tabs +### Tabs Takes the basic nav from above and adds the `.nav-tabs` class to generate a tabbed interface. Use them to create tabbable regions with our [tab JavaScript plugin](#javascript-behavior). @@ -101,7 +103,7 @@ Takes the basic nav from above and adds the `.nav-tabs` class to generate a tabb {% endexample %} -## Pills +### Pills Take that same HTML, but use `.nav-pills` instead: