Skeomorphic keys for keyboard documentation

I am writing some documentation for keyboard shortcuts for some programs. The documentation is in html / css / js. I would like to have images (skeuomorphic?) Of Keys controland cinstead of having only [ctrl] + [c]. I saw how this was done on the Internet, but I cannot find any solutions when searching on the Internet.

How can I render Control and C keys as images using HTML / CSS / JS? I am pleased to use a third-party library to achieve the effect.

+4
source share
2 answers

CSS , <kbd></kbd>, , , , StackOverflow.

CSS

kbd {
    padding: .1em .6em;
    border: 1px solid #ccc;
    font-size: 11px;
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f7f7f7;
    color: #333;
    -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px #fff inset;
    -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px #fff inset;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px #fff inset;
    border-radius: 3px;
    display: inline-block;
    margin: 0 .1em;
    text-shadow: 0 1px 0 #fff;
    line-height: 1.4;
    white-space: nowrap
}

HTML

<kbd></kbd>+<kbd>X</kbd><br><br>

<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Delete</kbd>

+ X

Ctrl + Alt + Delete

+2

CSS- . Google "key key css" , , KEYS.css: :

<link rel="stylesheet" href="keys.css" type="text/css" />
...
<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>S</kbd>

:

rendering of Ctrl + Shift + S using KEYS.css

+4

Source: https://habr.com/ru/post/1570248/


All Articles