【问题标题】:Why is my pseudo element showing up in one HTML demo but not in my angular 5 app?为什么我的伪元素出现在一个 HTML 演示中,但没有出现在我的 Angular 5 应用程序中?
【发布时间】:2018-07-27 21:48:55
【问题描述】:
    .gallery.style2 > .forward, .gallery.style2 > .backward {
        text-decoration: none;
        -moz-transition: opacity 0.2s ease-in-out;
        -webkit-transition: opacity 0.2s ease-in-out;
        -ms-transition: opacity 0.2s ease-in-out;
        transition: opacity 0.2s ease-in-out;
        position: absolute;
        top: 0;
        width: 5rem;
        height: 100%;
        cursor: pointer;
        opacity: 0;
        z-index: 2;
    }

        .gallery.style2 > .forward:before, .gallery.style2 > .backward:before {
            -moz-osx-font-smoothing: grayscale;
            -webkit-font-smoothing: antialiased;
            font-family: FontAwesome;
            font-style: normal;
            font-weight: normal;
            text-transform: none !important;
        }

        .gallery.style2 > .forward:before, .gallery.style2 > .backward:before {
            display: block;
            top: calc(50% - 1.5rem);
            width: 4rem;
            height: 3rem;
            line-height: 1em;
            font-size: 3rem;
            position: absolute;
            text-align: center;
        }

    .gallery.style2:hover > .forward, .gallery.style2:hover > .backward {
        opacity: 1;
    }

    .gallery.style2 > .forward {
        right: 0;
        background-image: linear-gradient(to left, rgba(0, 0, 0, 0.25) 15%, transparent);
    }

        .gallery.style2 > .forward:before {
            content: '\f105';
            right: 0;
        }

    .gallery.style2 > .backward {
        left: 0;
        background-image: linear-gradient(to right, rgba(0, 0, 0, 0.25) 15%, transparent);
    }

        .gallery.style2 > .backward:before {
            content: '\f104';
            left: 0;
        }

我正在通过英雄之旅教程学习一些 Angular,我想玩一些来自 HTML5UP.net 的漂亮 CSS。这是一些伪元素的 CSS 的 sn-p(类似画廊的元素上的向前箭头和向后箭头)。 This 是 HTML 和 CSS 的实际演示,它在“画廊”部分按预期工作。但是,一旦我将所有 CSS 导入到我的 Angular 项目中,伪元素就不会出现。

知道如何让他们按照演示中的方式工作吗?我认为他们应该使用 Angular 是不是很愚蠢?

【问题讨论】:

  • 是全局导入 CSS 样式还是将它们导入组件样式表?
  • 您也可以发布您的HTML 吗?因为我们是程序员而不是魔术师 :D 这会有所帮助
  • 我全局导入了 CSS 样式。经过一番挖掘,结果发现有一些 javascript 文件应该为未正确导入的画廊元素生成一些元素。一旦我将它们导入到我的 index.html 而不是我的 app.component.html 中,一切都完美无缺。

标签: css angular angular5 pseudo-element


【解决方案1】:

我全局导入了 CSS 样式。经过一番挖掘,结果发现有一些 javascript 文件应该为未正确导入的画廊元素生成一些元素。一旦我将它们导入到我的 index.html 而不是我的 app.component.html 中,一切都完美无缺。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-03-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多