Skip to content

Commit

Permalink
Fixes #11193: Add kbd element styles to indicate user input via keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
mdo committed Dec 7, 2013
1 parent fe58357 commit b1215d1
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 4 deletions.
9 changes: 8 additions & 1 deletion _includes/nav-css.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@
<li><a href="#type-lists">Lists</a></li>
</ul>
</li>
<li><a href="#code">Code</a></li>
<li>
<a href="#code">Code</a>
<ul class="nav">
<li><a href="#code-inline">Inline code</a></li>
<li><a href="#code-user-input">User input</a></li>
<li><a href="#code-block">Blocks of code</a></li>
</ul>
</li>
<li>
<a href="#tables">Tables</a>
<ul class="nav">
Expand Down
13 changes: 11 additions & 2 deletions css.html
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ <h4>Auto-truncating</h4>
<h1 id="code">Code</h1>
</div>

<h2>Inline</h2>
<h2 id="code-inline">Inline</h2>
<p>Wrap inline snippets of code with <code>&lt;code&gt;</code>.</p>
<div class="bs-example">
For example, <code>&lt;section&gt;</code> should be wrapped as inline.
Expand All @@ -1056,7 +1056,16 @@ <h2>Inline</h2>
For example, <code>&lt;section&gt;</code> should be wrapped as inline.
{% endhighlight %}

<h2>Basic block</h2>
<h2 id="code-user-input">User input</h2>
<p>Use the <code>&lt;kbd&gt;</code> to indicate input that is typically entered via keyboard.</p>
<div class="bs-example">
To switch directories, type <kbd>cd</kbd> followed the name of the directory.
</div>
{% highlight html %}
To switch directories, type <kbd>cd</kbd> followed the name of the directory.
{% endhighlight %}

<h2 id="code-block">Basic block</h2>
<p>Use <code>&lt;pre&gt;</code> for multiple lines of code. Be sure to escape any angle brackets in the code for proper rendering.</p>
<div class="bs-example">
<pre>&lt;p&gt;Sample text here...&lt;/p&gt;</pre>
Expand Down
9 changes: 9 additions & 0 deletions dist/css/bootstrap.css
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,15 @@ code {
border-radius: 4px;
}

kbd {
padding: 2px 4px;
font-size: 90%;
color: #ffffff;
background-color: #333333;
border-radius: 3px;
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

pre {
display: block;
padding: 9.5px;
Expand Down
2 changes: 1 addition & 1 deletion dist/css/bootstrap.min.css

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions less/code.less
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ code {
border-radius: @border-radius-base;
}

// User input typically entered via keyboard
kbd {
padding: 2px 4px;
font-size: 90%;
color: @kbd-color;
background-color: @kbd-bg;
border-radius: @border-radius-small;
box-shadow: inset 0 -1px 0 rgba(0,0,0,.25);
}

// Blocks of code
pre {
display: block;
Expand Down
3 changes: 3 additions & 0 deletions less/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,9 @@
@code-color: #c7254e;
@code-bg: #f9f2f4;

@kbd-color: #fff;
@kbd-bg: #333;

@pre-bg: #f5f5f5;
@pre-color: @gray-dark;
@pre-border-color: #ccc;
Expand Down

0 comments on commit b1215d1

Please sign in to comment.