css - 为什么 css margin-right 在 angular 8 上无效,带有清晰-ui?
问题描述
右边距的 css 规则似乎在具有清晰设计系统的 angular 8 中无效。请参阅下面的详细信息。
我有一个带有清晰设计系统的 angular 8 项目。我已经设置了标题和垂直导航,如下面的屏幕截图所示:
在内容区域,我正在尝试一些 CSS。
问题:以下规则的边距设置在右侧似乎无效。
样式.component.css:
.xxx {
border: 2px solid #e7642c;
width: 200px;
margin: 10px;
padding: 10px;}
h2, p {
width: 200px;
font-size: 80%;
line-height: 1.4em;}
样式.component.html:
<div class="xxx">
<h2>Moog</h2>
<p>Moog synthesisers were created by Dr. Robert Moog under the company name Moog Music. Popular models include the
Moog Modular, Minimoog, Micromoog, Moog Rogue, and Moog Source.</p>
</div>
屏幕截图:(
来源:ebe.co.ke)
从屏幕截图中您可以看到,文本正在溢出。我做错了什么或如何避免这种情况?
解决方案
你给了宽度:200px;到 h2 和 p 标签
而不是你可以试试这个
.xxx {
border: 2px solid #e7642c;
width: 200px;
margin: 10px;
padding: 10px;
box-sizing: border-box;
}
h2, p {
width: 100%;
font-size: 80%;
line-height: 1.4em;
}
CSS box-sizing 属性允许我们在元素的总宽度和高度中包含填充和边框。
推荐阅读
- java - 如何在我的 java 项目中寻址文件夹?
- java - Java 扫描仪的工作原理
- php - Blade Laravel 中的未定义变量
- sql - 如何选择一些具有空行或空行的列
- r - DT 根据单独的数据框将背景颜色应用于单元格
- git - 构建失败并出现错误:无法锁定 ref 'refs/remotes/origin/users/bill.roper/develop':位于 b10165 但预期为 5f
- flutter - 除非使用 Center 包装小部件,否则 Flutter 设置容器小部件的宽度和高度不起作用?为什么?
- javascript - 使用 Bootstrap 3.3 更改打印行顺序
- postgresql - 具有多列索引的 postgres 查询的执行时间很慢
- javascript - 嵌入表单并将其发布到另一个站点