【问题标题】:can't show icons with coreUi无法使用 coreUi 显示图标
【发布时间】:2017-07-15 08:37:55
【问题描述】:

我正在发现 coreUI。

我正在尝试创建在 github 上找到的 login.html: https://github.com/mrholek/CoreUI-Free-Bootstrap-Admin-Template/blob/master/Static_Full_Project_GULP/pages-login.html

一切正常,但无法显示用户图标和锁定图标。相反,我得到了它们的默认图标。

我正在处理一个名为 coreUI 的文件夹,其中包含:

  • login.html

  • css 文件夹(包含来自 git repo 的 style.css 和 simple-line-icons.css)

  • bower_components 文件夹(包含 jquery、bootstarp 和 tether)

所以路径应该是正确的。

此外,当我在浏览器中检查元素时,我可以在 css 规则选项卡中看到锁定图标和用户图标的内容 \e08e\e005。 但它们显示的是相同的默认图标。任何帮助将不胜感激。

我也尝试过 register.html ; https://github.com/mrholek/CoreUI-Free-Bootstrap-Admin-Template/blob/master/Static_Full_Project_GULP/pages-register.html 但同样的问题。所有图标默认显示。

这是我的 login.html

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

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="...">
    <meta name="author" content="....">
    <meta name="keyword" content="....">

    <!-- FavIcon link-->
    <link rel="shortcut icon" href="../favicon.png">
    <!-- Icons -->
    <link href="css/simple-line-icons.css" rel="stylesheet">


    <link href="css/style.css" rel="stylesheet">

    <title>Login</title>



</head>

<body class="app flex-row align-items-center">
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card-group mb-0">
                    <div class="card p-4">
                        <div class="card-block">
                            <h1>Sign In</h1>
                            <p class="text-muted">Sign In to your account</p>
                            <div class="input-group mb-3">
                                <span class="input-group-addon"><i class="icon-user"></i>
                                </span>
                                <input type="text" class="form-control" placeholder="Username">
                            </div>
                            <div class="input-group mb-4">
                                <span class="input-group-addon"><i class="icon-lock"></i>
                                </span>
                                <input type="password" class="form-control" placeholder="Password">
                            </div>
                            <div class="row">
                                <div class="col-6">
                                    <button type="button" class="btn btn-primary px-4">Login</button>
                                </div>
                                <div class="col-6 text-right">
                                    <button type="button" class="btn btn-link px-0">Forgot password?</button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="card card-inverse card-primary py-5 d-md-down-none" style="width:44%">
                        <div class="card-block text-center">
                            <div>
                                <h2>Sign up</h2>
                                <p>Site description....</p>
                                <button type="button" class="btn btn-primary active mt-3">Register</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>


<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/tether/dist/js/tether.min.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

</body>

</html>

【问题讨论】:

    标签: html css icons


    【解决方案1】:

    我认为您没有在字体目录中添加字体文件夹或字体。

    SO 创建一个文件夹 fonts 添加简单图标的字体文件。如果你已经有字体文件夹,那么在这个文件夹中添加字体。

    【讨论】:

    • 您已使用“simple-line-icons.css”文件来渲染字体。仅当您在字体文件夹中添加所有 simle 行的字体时,它才会呈现。因为用户图标和锁定图标。图标是从 simple-line-icons.css 文件中呈现的特殊字体
    【解决方案2】:

    如果您想使用 @coreui/icons,这就是您的 angular.json 的外观

    "styles": [
                  "src/styles.sass",
                  "node_modules/@coreui/coreui/dist/css/coreui.css",
                  "node_modules/@coreui/icons/css/all.css"
    

    【讨论】:

      【解决方案3】:

      您在 angular.json 中的设置可能会免费列出:

       "styles": [
                    "node_modules/@coreui/icons/css/free.css",
      

      改为:

      "styles": [
                    "node_modules/@coreui/icons/css/all.css",
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-10-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-01-13
        • 2020-11-17
        相关资源
        最近更新 更多