我想为我的应用程序中的弹出通知做一个响应式设计。我正在使用 Angular Toaster 作为通知。
例如,我将 toaster-container 元素定位在屏幕的中心,但使用的是绝对位置,因此对于较小的屏幕,通知会保持在同一位置,因此不会显示。我想让通知相对于包含它们的父元素(在本例中为容器网格)。如何使用 CSS 实现这一点?这是我的html代码:
<body data-ng-controller="AppController">
<div id="container" class="container">
<toaster-container toaster-options="{'position-class': 'toast-container-custo','time-out': 3000, 'close-button':true}"></toaster-container>
<div id="header" data-ng-include="'partials/header/header.html'" ></div>
<div data-ng-view></div>
<div id="footer" data-ng-include="'partials/footer/footer.html'"></div>
<!-- This is the div with the overlay css class, so no matter where it is located this div inside the screen, it will cover the whole screen-->
<div id="loader" class="loading overlay" data-ng-if="loader.loading">
<p>We are loading the products. Please wait...</p>
<img alt="" src="images/ajax-loader.gif">
</div>
</div>
<div id="loginPanel" data-ng-include="'partials/content/panels/login.html'"></div>
</body>
以及我用于 toaster-container 元素的自定义 css 规则:
.toast-container-custo
{
position: absolute;
top:100px;
left: 780px;
}