【发布时间】:2021-11-09 10:36:56
【问题描述】:
我在 AEM 中有一个场景,它在容器级别默认 AEM 的 CSS 为 float: left,因为整个流程都会受到影响,所以无法删除它,但是在同一个 div 上,我需要实现 max-width:1280px与中心对齐。以下代码无法删除类容器,我必须添加一个额外的类来实现它。到目前为止我尝试过的代码。
注意:我不能删除浮动属性,因为它的核心组件。
任何帮助将不胜感激!
.custom-container{
border: 1px solid red;
max-width: 1280px;
margin-left: auto;
margin-right:auto;
display: inline-block;
}
.container{
float: left;
clear: none;
width: 100%;
box-sizing: border-box;
}
<div class="container custom-container">
<div class="sub-value">
<p>is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<p>is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</div>
【问题讨论】:
标签: html css css-float margin display