简体   繁体   English

如何在另一个工具栏下创建固定工具栏

[英]How to create fixed toolbar under another toolbar

I want to create toolbar under toolbar, first toolbar is not fixed, second bar is fixed, second bar fixed in the top of the screen like in the site: https://www.lingvolive.com/ru-ru/translate/en-ru/overflow .我想在工具栏下创建工具栏,第一个工具栏不是固定的,第二个工具栏是固定的,第二个工具栏固定在屏幕顶部,就像网站一样: https : //www.lingvolive.com/ru-ru/translate/en -ru/溢出 How to do it in angular with material.如何与材料成角度地做到这一点。

This isn't angular specific and can be accomplished with simple css.这不是特定于角度的,可以使用简单的 css 来完成。 Here are some docs on the subject https://developer.mozilla.org/en-US/docs/Web/CSS/position#sticky_positioning这里有一些关于这个主题的文档https://developer.mozilla.org/en-US/docs/Web/CSS/position#sticky_positioning

something like this should do it:这样的事情应该这样做:

<div>top toolbar</div>
<div style="position: sticky; top: 0; position: -webkit-sticky;">Sticky Toolbar</div>

 <div>top toolbar</div> <div style="background-color: red; position: sticky; top: 0; position: -webkit-sticky;">Sticky Toolbar</div> <p>Padding for scroll</p> <p>Padding for scroll</p> <p>Padding for scroll</p> <p>Padding for scroll</p> <p>Padding for scroll</p> <p>Padding for scroll</p> <p>Padding for scroll</p> <p>Padding for scroll</p>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM