Skip to content

Commit 79c159d

Browse files
committed
Add styles for <kbd> elements
Allows for special styles to call them out since they're different than normal text and different than code. They can make use of styles they inherit for font style and weight. Notes on changes: - Added new CSS variables for reused elements - The font-* rules are separate for each aspect so that they can inherit bold/italic/etc Closes #1813
1 parent a8c37ce commit 79c159d

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/theme/css/general.css

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ body {
2222
}
2323

2424
code {
25-
font-family: "Source Code Pro", Consolas, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace, monospace !important;
26-
font-size: 0.875em; /* please adjust the ace font size accordingly in editor.js */
25+
font-family: var(--mono-font) !important;
26+
font-size: var(--code-font-size);
2727
}
2828

2929
/* make long words/inline code not x overflow */
@@ -148,6 +148,18 @@ blockquote {
148148
border-bottom: .1em solid var(--quote-border);
149149
}
150150

151+
kbd {
152+
background-color: var(--table-border-color);
153+
border-radius: 4px;
154+
border: solid 1px var(--theme-popup-border);
155+
box-shadow: inset 0 -1px 0 var(--theme-hover);
156+
display: inline-block;
157+
font-size: var(--code-font-size);
158+
font-family: var(--mono-font);
159+
line-height: 10px;
160+
padding: 4px 5px;
161+
vertical-align: middle;
162+
}
151163

152164
:not(.footnote-definition) + .footnote-definition,
153165
.footnote-definition + :not(.footnote-definition) {

src/theme/css/variables.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
--page-padding: 15px;
77
--content-max-width: 750px;
88
--menu-bar-height: 50px;
9+
--mono-font: "Source Code Pro", Consolas, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace, monospace;
10+
--code-font-size: 0.875em /* please adjust the ace font size accordingly in editor.js */
911
}
1012

1113
/* Themes */

test_book/src/individual/mixed.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ fn main(){
2727
}
2828
```
2929

30+
<kbd>Ctrl</kbd> + <kbd>S</kbd> saves a file.
31+
3032
A random image sprinkled in between
3133

3234
![16x16 rust-lang logo](http://rust-lang.org/logos/rust-logo-16x16.png)
@@ -41,6 +43,7 @@ A random image sprinkled in between
4143
2. be
4244
3. `put`
4345
4. here?
46+
5. **<kbd>Ctrl</kbd> + <kbd>S</kbd> saves a file.**
4447

4548
| col1 | col2 | col 3 | col 4 | col 5 | col 6 |
4649
| ---- | ---- | ----- | ----- | ----- | ----- |

0 commit comments

Comments
 (0)