css - Angular w/Flexbox app-root 不是 100% 宽

标签 css angular flexbox angular7

我正在尝试使用带有 Flexbox 的 Angular 7。

准确地说是 bool 玛。

我的 app-root 组件不是 100% 宽。我怎样才能正确地实现这一目标?

我的 styles.scss 看起来像

@import "./variables";
@import "~bulma";
html,
body {
    height: 100%;
}

body {
    display: flex;
}

app-root {
    height: 100%;
    width: 100%;
}

这可行,但是我不确定以这种方式使用 app-root 是否正确。

最佳答案

你有app.component.scss文件吗?

您可以添加它,它应该正确定位该组件。

:host {
    width: 100%;
    height: 100%;
}

:host 用于定位托管元素(例如 )。

关于css - Angular w/Flexbox app-root 不是 100% 宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53333896/

相关文章:

angular - 下载 zip 中的许多大文件。正确实现

angular - 如何以 react 形式设置 Prime NG 单选按钮默认值

html - 拉伸(stretch)一个元素以填充其容器的其余部分,同时插入以下元素进行换行?

css - 按钮的 CSS 不会改变

angular - 异常 : Root segment cannot have matrix parameters

css - Firefox 上的按钮太高

javascript - 如何防止调整大小的 TextArea 溢出页面?

css - 如何使用vue创建动态网格?

css - 在 Stylus 的减号周围放置空格是否合适?

javascript - 如何将 css 类应用于特定表格列和行?