div+css实现8种编程等宽字体代码演示代码

代码语言:html

所属分类:布局界面

代码描述:div+css实现8种编程等宽字体代码演示代码

代码标签: div css 8种 编程 等宽 字体 代码 演示 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>编程等宽字体 · 展示与对比</title>
    <!-- 使用 Google Fonts 加载部分开源字体,确保跨平台显示 -->
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <!-- Fira Code (带连字) -->
    <link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500&display=swap" rel="stylesheet">
    <!-- JetBrains Mono (带连字) -->
    <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
    <!-- IBM Plex Mono -->
    <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&display=swap" rel="stylesheet">
    <!-- Source Code Pro -->
    <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;500&display=swap" rel="stylesheet">
    <!-- Roboto Mono -->
    <link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500&display=swap" rel="stylesheet">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        body {
            background: #0d1117;
            color: #e6edf3;
            font-family: system-ui, -apple-system, sans-serif;
            padding: 2rem 1.5rem;
        }
        .container {
            max-width: 1400px;
            margin: 0 auto;
        }
        h1 {
            font-weight: 500;
            font-size: 2.2rem;
            letter-spacing: -0.02em;
            margin-bottom: 0.3rem;
            background: linear-gradient(135deg, #f0f6fc, #58a6ff);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        .subhead {
            color: #8b949e;
            margin-bottom: 2.5rem;
            border-left: 3px solid #30363d;
            padding-left: 1rem;
            font-size: 1.05rem;
        }
        .font-grid {
            display: flex;
            flex-direction: column;
            gap: 2.5rem;
        }
        .font-card {
            background: #161b22;
            border: 1px solid #30363d;
            border-radius: 16px;
            padding: 1.5rem 2rem 2rem 2rem;
            transition: background 0.15s, border-color 0.15s;
            box-shadow: 0 8px 24px rgba(0,0,0,0.4);
        }
        .font-card:hover {
            background: #1c2333;
            border-color: #58a6ff66;
        }
        .font-header {
            display: flex;
            flex-wrap: wrap;
   .........完整代码请登录后点击上方下载按钮下载查看

网友评论0