html - 如何随着列表的增长扩展列表的高度?

标签 html css angular

我在应用程序的导航栏中有这个 Angular 组件

enter image description here

这个组件基本上会列出用户最喜欢的元素。 列表中可以有 1 项、2 项或 10 项。

我想在 CSS 中做一些事情来根据收藏夹列表的长度更改此组件的高度。 我该怎么做才能根据列表的长度增加我的组件的高度

我的代码:

.favorite-notification-panel {
  height: calc(43vh - 100px);
  width: 900px !important;
  overflow: hidden;
  right: -176% !important;
  top: 38px;
}
<!-- FAVORITE ITEMS-->
<ul id="favorite_panel" [@mobileHeaderNavRight]="navRight" class="nav-right profile-menu-aling notification-bell">
  <li class="user-profile header-notification favorite-pointer" (clickOutside)="favoritePanelOutsideClick($event)" [ngClass]="favoriteDevicesNotificationClass">
    <a href="javascript:" (click)="toggleFavoriteNotification()">
      <img _ngcontent-c2="" class="fav-icon-align" src="assets/images/widget/ic_star_menu.png" />
    </a>

    <!-- component from favorite items -->
    <app-favorite-devices class="profile-notification favorite-notification-panel" [@notificationBottom]="favoriteDevicesNotification" [ItemsFavorited]="itemFavorited">
    </app-favorite-devices>
  </li>
</ul>

最佳答案

    .favorite-notification-panel {
   height:fit-content;
   min-height: calc(43vh - 100px);
   width: 900px !important;
   overflow:hidden;
   right: -176% !important;
   top: 38px;
}

关于html - 如何随着列表的增长扩展列表的高度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56079195/

相关文章:

javascript - 在 Bootstrap 列中居中一个 div

jQuery css 固定在左侧但绝对在顶部

html - CSS 多级下拉菜单

angular - 错误 : No provider for HttpHandler in angular2

html - 如何使用 CSS 制作带有固定标题的可滚动表

html - 为什么 CSS min-width 属性不强制 div 具有指定的最小宽度?

html - span 不会在 mozilla 的按钮内保持垂直居中

javascript - Angular 2 : how do display character count on reactive form input

javascript - Angular:未收到事件发射器

html - 在个人 tumblr 帖子中编辑 CSS