javascript - 在 Angular 中使用选择器时,如何设置组件显示的大小?
问题描述
我正在使用选择器,<component-selector></component-selector>
在页面中显示组件的内容,但它当前显示太大,切断了组件内容的右侧,我试过这个:
<div style="width: 100%; height: 100%; display: block;">
<component-selector></component-selector>
</div>
因为我希望它填满整个页面,但不显示为大于页面,但这不起作用。如何设置此 div 以使组件占据整个页面,但不会更大/被切断?
解决方案
使用两个 div 作为块 Outer 和 Inner One,如果您使用的是选择器,那么您将在选择器 html 代码集中使用一些 html 代码,width:"100%"
并在 out div 中使用max-width:"1170px"
.
所以这样写:
<div style="width:100%"> // in selector html code
和
<div style="width:1170px">// in your Outer container as you are using
所以最终的代码看起来像这样
<div style="width:1170px; margin: 0px 15px; display:inline-block">
<selector></selector> // here in this html file set width as 100%
</div>
如果您想要解决方案,将在 stackblitz 中编码并与您分享链接,但我知道您可以通过此参考来完成。
推荐阅读
- reactjs - axios HTTP DELETE请求返回415错误
- data-visualization - 有人知道如何共享 google colab 文档,以便人们可以运行笔记本但看不到实际代码吗?
- java - 不了解 Android Mediaplayer 同步
- r - 对数据集中的几对使用 cpquery 函数
- sql - How to retrieve a particular number from the string XXXX-XXXX-XXX-XXXX through SQL
- python - 无法使用 python 检索所有 XML 数据
- search - Fuse.js:完全匹配的名称
- aws-amplify - snsdev-dev 已存在于堆栈中
- c# - 拆分由任何非数字字符串分隔的数字
- python - 格式化分类报告以显示不同的指标