我有一个想要在页面底部对齐的div。为此,我使用了以下内容--
<div style="position:fixed;bottom:0;overflow:auto;word-wrap:break-word;display:block" ng-show="noData || failedStatus">
<div class="alert alert-danger" ng-show="noData" style="overflow:auto;word-wrap: break-word;">
<!-- something -->
</div>
<div class="alert alert-danger" ng-show="failedStatus" style="overflow:auto;word-wrap: break-word;">
<!-- something -->
</div>
</div>这段代码对齐了底部的div,但没有对div内部的单词进行包装。
发布于 2015-06-17 18:48:01
这是Fiddle Demo
您的css中缺少position:absolute;。
最推荐的做法是避免内联css,而是让类与父div关联,然后将css应用于它。
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<style>
.footer-div{
bottom:0;
overflow:auto;
word-wrap:break-word;
display:block;
position: absolute;
}
</style>
</head>
<body>
<div class="footer-div" ng-show="noData || failedStatus">
<div class="alert alert-danger" ng-show="noData" style="overflow:auto;word-wrap: break-word;">
<!-- something -->
Some text
</div>
<div class="alert alert-danger" ng-show="failedStatus" style="overflow:auto;word-wrap: break-word;">
<!-- something -->
Some text
</div>
</div>
</body>
</html>https://stackoverflow.com/questions/30888959
复制相似问题