Fonts icon combined with pseudo-element

Fonts icon combined with pseudo-element


Code:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        @font-face {
            font-family: 'icomoon';
            src: url('fonts/icomoon.eot?sz2z9h');
            src: url('fonts/icomoon.eot?sz2z9h#iefix') format('embedded-opentype'),
                url('fonts/icomoon.ttf?sz2z9h') format('truetype'),
                url('fonts/icomoon.woff?sz2z9h') format('woff'),
                url('fonts/icomoon.svg?sz2z9h#icomoon') format('svg');
            font-weight: normal;
            font-style: normal;
            font-display: block;
        }

        .search {
            width: 250px;
            height: 35px;
            border: 1px solid #ccc;
        }

        .search::after {
            font-family: 'icomoon';
            content: '\e986';
        }
    </style>
</head>

<body>
    <div class="search">搜索</div>
</body>

</html>

Renderings:

最基本的显示,未作任何调整

Here Insert Picture Description

Published 11 original articles · won praise 0 · Views 449

Guess you like

Origin blog.csdn.net/qq_36323561/article/details/105087216