【发布时间】:2021-04-28 02:16:46
【问题描述】:
我需要在屏幕底部固定一个操作栏。
以下 CSS 在桌面模式下运行良好:
<div class="slds-p-around--large actions">
<lightning-button-stateful
label-when-off="Check All"
label-when-on="Uncheck All"
label-when-hover="Uncheck All"
icon-name-when-off="utility:check"
icon-name-when-on="utility:close"
icon-name-when-hover="utility:close"
selected={selected}
onclick={handleMasterSelection}>
</lightning-button-stateful>
<button class="slds-button slds-button--success" onclick={handleApprove}>Approve</button>
<button class="slds-button slds-button--destructive" onclick={showConfirmationModal}>Deny</button>
</div>
.actions{
position: fixed;
bottom: 0;
width: 100%;
background-color: #F3F2F2;
left: 0;
display: block;
height: 8vh;
z-index: 10000;
}
但在移动模式下它不起作用,div 不固定。我必须滚动到页面底部才能看到它。
有什么线索吗?
【问题讨论】:
-
你能分享剩下的代码或JS小提琴来测试它
-
发布与您提供的 css 代码相关联的 html 代码
-
移除左侧属性并再次测试
-
感谢您的回答。我更新了 html 代码。移除 left 属性并没有改变任何东西。
-
你所拥有的是完美地在不同的屏幕上工作,尝试删除主 div 的其他类名,看看它们是否影响它,我测试了你所拥有的,它适用于移动和桌面