html - 调整ui-view元素的高度[Angular.js Angular UI Router]

标签 html css angularjs angular-ui-router

我正在使用 angular.js 和 angular-ui-router。 ui-view 元素的高度有点问题。它固定在视口(viewport)的高度而不是它的内容。随着内容的动态更新,内容的高度发生变化,但父 ui-view 元素的高度保持不变。因此,body 元素的高度也与 ui-view 的高度保持不变。如何解决这个问题

<body> 
    <div ui-view>
        <div id = "content"> 
            <!-- Some content with height more then that of view-port -->
        </div>
    </div>
</body>

最佳答案

这是一个 CSS 问题,而不是 Angular 问题。您的 body 可能已将高度设置为 100%。将其设置为

body {
    height: auto;
}

会修复它。

Documentation :

A percentage height on the root element is relative to the initial containing block.

关于html - 调整ui-view元素的高度[Angular.js Angular UI Router],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27084206/

相关文章:

html - 在 Ionic 中使用 API 执行登录时出现 JSON 错误

javascript - Angular 7 - 为动态创建的组件添加拖放行为

html - 使用 CSS3 或图像的圆 Angular ?

javascript - AngularJS 嵌套 ng-repeats 与单个索引?

javascript - AngularJs 注销 Action

javascript - 使用 AngularJS 将 30 天添加到当前日期并更新日历值更改时计算的天数

jquery - 当幻灯片放映时,淡出图像出现在屏幕上

jQuery hide() 隐藏了它不应该隐藏的东西

javascript - 在 Angular 中旋转伪 3d 旋转木马

html - 如何在段落 <p> 中为图像添加标题?