mirror of
https://github.com/twbs/bootstrap.git
synced 2024-11-29 11:24:18 +01:00
Merge pull request #14577 from twbs/pagination-role-nav
Wrap .pagination & .pager in <nav> to improve accessibility
This commit is contained in:
commit
48c67095b0
@ -6,73 +6,7 @@
|
|||||||
<h2 id="pagination-default">Default pagination</h2>
|
<h2 id="pagination-default">Default pagination</h2>
|
||||||
<p>Simple pagination inspired by Rdio, great for apps and search results. The large block is hard to miss, easily scalable, and provides large click areas.</p>
|
<p>Simple pagination inspired by Rdio, great for apps and search results. The large block is hard to miss, easily scalable, and provides large click areas.</p>
|
||||||
<div class="bs-example">
|
<div class="bs-example">
|
||||||
<ul class="pagination">
|
<nav>
|
||||||
<li><a href="#">«</a></li>
|
|
||||||
<li><a href="#">1</a></li>
|
|
||||||
<li><a href="#">2</a></li>
|
|
||||||
<li><a href="#">3</a></li>
|
|
||||||
<li><a href="#">4</a></li>
|
|
||||||
<li><a href="#">5</a></li>
|
|
||||||
<li><a href="#">»</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{% highlight html %}
|
|
||||||
<ul class="pagination">
|
|
||||||
<li><a href="#">«</a></li>
|
|
||||||
<li><a href="#">1</a></li>
|
|
||||||
<li><a href="#">2</a></li>
|
|
||||||
<li><a href="#">3</a></li>
|
|
||||||
<li><a href="#">4</a></li>
|
|
||||||
<li><a href="#">5</a></li>
|
|
||||||
<li><a href="#">»</a></li>
|
|
||||||
</ul>
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
<h3>Disabled and active states</h3>
|
|
||||||
<p>Links are customizable for different circumstances. Use <code>.disabled</code> for unclickable links and <code>.active</code> to indicate the current page.</p>
|
|
||||||
<div class="bs-example">
|
|
||||||
<ul class="pagination">
|
|
||||||
<li class="disabled"><a href="#">«</a></li>
|
|
||||||
<li class="active"><a href="#">1 <span class="sr-only">(current)</span></a></li>
|
|
||||||
<li><a href="#">2</a></li>
|
|
||||||
<li><a href="#">3</a></li>
|
|
||||||
<li><a href="#">4</a></li>
|
|
||||||
<li><a href="#">5</a></li>
|
|
||||||
<li><a href="#">»</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{% highlight html %}
|
|
||||||
<ul class="pagination">
|
|
||||||
<li class="disabled"><a href="#">«</a></li>
|
|
||||||
<li class="active"><a href="#">1 <span class="sr-only">(current)</span></a></li>
|
|
||||||
...
|
|
||||||
</ul>
|
|
||||||
{% endhighlight %}
|
|
||||||
<p>You can optionally swap out active or disabled anchors for <code><span></code> to remove click functionality while retaining intended styles.</p>
|
|
||||||
{% highlight html %}
|
|
||||||
<ul class="pagination">
|
|
||||||
<li class="disabled"><span>«</span></li>
|
|
||||||
<li class="active"><span>1 <span class="sr-only">(current)</span></span></li>
|
|
||||||
...
|
|
||||||
</ul>
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
|
|
||||||
<h3>Sizing</h3>
|
|
||||||
<p>Fancy larger or smaller pagination? Add <code>.pagination-lg</code> or <code>.pagination-sm</code> for additional sizes.</p>
|
|
||||||
<div class="bs-example">
|
|
||||||
<div>
|
|
||||||
<ul class="pagination pagination-lg">
|
|
||||||
<li><a href="#">«</a></li>
|
|
||||||
<li><a href="#">1</a></li>
|
|
||||||
<li><a href="#">2</a></li>
|
|
||||||
<li><a href="#">3</a></li>
|
|
||||||
<li><a href="#">4</a></li>
|
|
||||||
<li><a href="#">5</a></li>
|
|
||||||
<li><a href="#">»</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<ul class="pagination">
|
<ul class="pagination">
|
||||||
<li><a href="#">«</a></li>
|
<li><a href="#">«</a></li>
|
||||||
<li><a href="#">1</a></li>
|
<li><a href="#">1</a></li>
|
||||||
@ -82,8 +16,84 @@
|
|||||||
<li><a href="#">5</a></li>
|
<li><a href="#">5</a></li>
|
||||||
<li><a href="#">»</a></li>
|
<li><a href="#">»</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</nav>
|
||||||
<div>
|
</div>
|
||||||
|
{% highlight html %}
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
<li><a href="#">«</a></li>
|
||||||
|
<li><a href="#">1</a></li>
|
||||||
|
<li><a href="#">2</a></li>
|
||||||
|
<li><a href="#">3</a></li>
|
||||||
|
<li><a href="#">4</a></li>
|
||||||
|
<li><a href="#">5</a></li>
|
||||||
|
<li><a href="#">»</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{% endhighlight %}
|
||||||
|
|
||||||
|
<h3>Disabled and active states</h3>
|
||||||
|
<p>Links are customizable for different circumstances. Use <code>.disabled</code> for unclickable links and <code>.active</code> to indicate the current page.</p>
|
||||||
|
<div class="bs-example">
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
<li class="disabled"><a href="#">«</a></li>
|
||||||
|
<li class="active"><a href="#">1 <span class="sr-only">(current)</span></a></li>
|
||||||
|
<li><a href="#">2</a></li>
|
||||||
|
<li><a href="#">3</a></li>
|
||||||
|
<li><a href="#">4</a></li>
|
||||||
|
<li><a href="#">5</a></li>
|
||||||
|
<li><a href="#">»</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
{% highlight html %}
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
<li class="disabled"><a href="#">«</a></li>
|
||||||
|
<li class="active"><a href="#">1 <span class="sr-only">(current)</span></a></li>
|
||||||
|
...
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{% endhighlight %}
|
||||||
|
<p>You can optionally swap out active or disabled anchors for <code><span></code> to remove click functionality while retaining intended styles.</p>
|
||||||
|
{% highlight html %}
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
<li class="disabled"><span>«</span></li>
|
||||||
|
<li class="active"><span>1 <span class="sr-only">(current)</span></span></li>
|
||||||
|
...
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
{% endhighlight %}
|
||||||
|
|
||||||
|
|
||||||
|
<h3>Sizing</h3>
|
||||||
|
<p>Fancy larger or smaller pagination? Add <code>.pagination-lg</code> or <code>.pagination-sm</code> for additional sizes.</p>
|
||||||
|
<div class="bs-example">
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination pagination-lg">
|
||||||
|
<li><a href="#">«</a></li>
|
||||||
|
<li><a href="#">1</a></li>
|
||||||
|
<li><a href="#">2</a></li>
|
||||||
|
<li><a href="#">3</a></li>
|
||||||
|
<li><a href="#">4</a></li>
|
||||||
|
<li><a href="#">5</a></li>
|
||||||
|
<li><a href="#">»</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<nav>
|
||||||
|
<ul class="pagination">
|
||||||
|
<li><a href="#">«</a></li>
|
||||||
|
<li><a href="#">1</a></li>
|
||||||
|
<li><a href="#">2</a></li>
|
||||||
|
<li><a href="#">3</a></li>
|
||||||
|
<li><a href="#">4</a></li>
|
||||||
|
<li><a href="#">5</a></li>
|
||||||
|
<li><a href="#">»</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
<nav>
|
||||||
<ul class="pagination pagination-sm">
|
<ul class="pagination pagination-sm">
|
||||||
<li><a href="#">«</a></li>
|
<li><a href="#">«</a></li>
|
||||||
<li><a href="#">1</a></li>
|
<li><a href="#">1</a></li>
|
||||||
@ -93,12 +103,12 @@
|
|||||||
<li><a href="#">5</a></li>
|
<li><a href="#">5</a></li>
|
||||||
<li><a href="#">»</a></li>
|
<li><a href="#">»</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
{% highlight html %}
|
{% highlight html %}
|
||||||
<ul class="pagination pagination-lg">...</ul>
|
<nav><ul class="pagination pagination-lg">...</ul></nav>
|
||||||
<ul class="pagination">...</ul>
|
<nav><ul class="pagination">...</ul></nav>
|
||||||
<ul class="pagination pagination-sm">...</ul>
|
<nav><ul class="pagination pagination-sm">...</ul></nav>
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
|
|
||||||
@ -108,46 +118,58 @@
|
|||||||
<h3>Default example</h3>
|
<h3>Default example</h3>
|
||||||
<p>By default, the pager centers links.</p>
|
<p>By default, the pager centers links.</p>
|
||||||
<div class="bs-example">
|
<div class="bs-example">
|
||||||
<ul class="pager">
|
<nav>
|
||||||
<li><a href="#">Previous</a></li>
|
<ul class="pager">
|
||||||
<li><a href="#">Next</a></li>
|
<li><a href="#">Previous</a></li>
|
||||||
</ul>
|
<li><a href="#">Next</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
{% highlight html %}
|
{% highlight html %}
|
||||||
<ul class="pager">
|
<nav>
|
||||||
<li><a href="#">Previous</a></li>
|
<ul class="pager">
|
||||||
<li><a href="#">Next</a></li>
|
<li><a href="#">Previous</a></li>
|
||||||
</ul>
|
<li><a href="#">Next</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
<h3>Aligned links</h3>
|
<h3>Aligned links</h3>
|
||||||
<p>Alternatively, you can align each link to the sides:</p>
|
<p>Alternatively, you can align each link to the sides:</p>
|
||||||
<div class="bs-example">
|
<div class="bs-example">
|
||||||
<ul class="pager">
|
<nav>
|
||||||
<li class="previous"><a href="#">← Older</a></li>
|
<ul class="pager">
|
||||||
<li class="next"><a href="#">Newer →</a></li>
|
<li class="previous"><a href="#">← Older</a></li>
|
||||||
</ul>
|
<li class="next"><a href="#">Newer →</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
{% highlight html %}
|
{% highlight html %}
|
||||||
<ul class="pager">
|
<nav>
|
||||||
<li class="previous"><a href="#">← Older</a></li>
|
<ul class="pager">
|
||||||
<li class="next"><a href="#">Newer →</a></li>
|
<li class="previous"><a href="#">← Older</a></li>
|
||||||
</ul>
|
<li class="next"><a href="#">Newer →</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
|
|
||||||
<h3>Optional disabled state</h3>
|
<h3>Optional disabled state</h3>
|
||||||
<p>Pager links also use the general <code>.disabled</code> utility class from the pagination.</p>
|
<p>Pager links also use the general <code>.disabled</code> utility class from the pagination.</p>
|
||||||
<div class="bs-example">
|
<div class="bs-example">
|
||||||
<ul class="pager">
|
<nav>
|
||||||
<li class="previous disabled"><a href="#">← Older</a></li>
|
<ul class="pager">
|
||||||
<li class="next"><a href="#">Newer →</a></li>
|
<li class="previous disabled"><a href="#">← Older</a></li>
|
||||||
</ul>
|
<li class="next"><a href="#">Newer →</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
{% highlight html %}
|
{% highlight html %}
|
||||||
<ul class="pager">
|
<nav>
|
||||||
<li class="previous disabled"><a href="#">← Older</a></li>
|
<ul class="pager">
|
||||||
<li class="next"><a href="#">Newer →</a></li>
|
<li class="previous disabled"><a href="#">← Older</a></li>
|
||||||
</ul>
|
<li class="next"><a href="#">Newer →</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -111,10 +111,12 @@
|
|||||||
<p>Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a pharetra augue.</p>
|
<p>Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a pharetra augue.</p>
|
||||||
</div><!-- /.blog-post -->
|
</div><!-- /.blog-post -->
|
||||||
|
|
||||||
<ul class="pager">
|
<nav>
|
||||||
<li><a href="#">Previous</a></li>
|
<ul class="pager">
|
||||||
<li><a href="#">Next</a></li>
|
<li><a href="#">Previous</a></li>
|
||||||
</ul>
|
<li><a href="#">Next</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
</div><!-- /.blog-main -->
|
</div><!-- /.blog-main -->
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user