【发布时间】:2018-02-09 18:45:33
【问题描述】:
好的,我有一个使用嵌入式视图的 Angular 应用程序。不确定这是否重要,但我将所有嵌入替换为普通 html 文件的实际外观。无论如何,我试图在页面底部水平居中一个固定的 uib-pagination 元素。
<!DOCTYPE html>
<html>
<head>
<title></title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!-- Imports for my personal stylesheet as well as ui-bootstrap's and angular material's stylesheets go here-->
</head>
<body style="width:100vw; height:auto">
<div ng-app="app" layout-fill ng-cloak>
<div class="root-container" layout-fill style="width:100vw; height:auto padding:0; position: absolute;">
<md-content layout="column" layout-fill style="width:100vw; height:auto">
<md-toolbar style="width:100vw; height:auto">
<div class="md-toolbar-tools">
<md-button aria-label="Go Back"> Go Back </md-button>
<md-button class="md-raised" aria-label="Learn More"> Learn More </md-button>
</div>
</md-toolbar>
<md-tabs md-selected="vm.selectedIndex" md-border-bottom>
<md-tab label="Home"> </md-tab>
<md-tab label="Submit"> </md-tab>
<md-tab label="Contact"> </md-tab>
</md-tabs>
<md-content class="main-body-content">
<ul uib-pagination total-items="vm.itemCount" items-per-page="vm.itemsPerPage" ng-model="vm.currentPage" ng-change="log()" max-size="vm.maxShownPagination" class="pagination-lg" boundary-links="true" force-ellipses="true">
</ul>
</md-content>
</div>
</md-content>
</div>
</div>
<!---- scripts go here ---->
</body>
</html>
这是我的样式表,主体内容的背景为红色,用于对比和查看:
.main-body-content {
height: 100vh;
width: 100vw;
background: red;
}
.pagination-lg {
position: fixed;
bottom: 0px;
width: 100vw;
margin-left: auto;
margin-right: auto;
}
下面是截图:
您可以看到分页元素位于页面底部附近,它会随着视口滚动,但它不是水平居中的。帮助? CSS 新手。
【问题讨论】:
标签: html css angularjs angular-ui-bootstrap angular-material