I recently tried Angular UI Layout ( https://github.com/angular-ui/ui-layout ), which is pretty easy to use. However, I found that the user interface layout always overlaps with the Bootstrap navigation bar.
You can look here: http://plnkr.co/edit/r5veawwbgz98bZjLdr1B
<!DOCTYPE html> <html ng-app="x"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width"> <title>UI.Layout Issue</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap-theme.min.css"> <link rel="stylesheet" href="https://rawgithub.com/angular-ui/ui-layout/v1.0.5/ui-layout.css"> <link rel="stylesheet" href="style.css"> </head> <body> <nav class="navbar navbar-default navbar-static-top"> <div class="container"> <div class="navbar-header"> <a class="navbar-brand" href="#"><i class="glyphicon glyphicon-envelope"></i><span>Website</span></a> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li class="active"><a href="#">menu1</a></li> <li><a href="#about">Menu2</a></li> <li><a href="#about">Menu3</a></li> <li><a href="#about">Menu4</a></li> <li><a href="#contact">Contact</a></li> </ul> </div> </div> </nav> <div ui-layout style="position:relative; height:500px"> <div ui-layout-container style="border-style: solid;"><h1>top</h1></div> <div ui-layout-container> <div ui-layout="{flow : 'column'}" > <div ui-layout-container style="border-style: solid;" ><h1>left</h1></div> <div ui-layout-container style="border-style: solid;" ><h1>right</h1></div> </div> </div> <div ui-layout-container style="border-style: solid;"><h1>bottom</h1></div> </div> <script type="application/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js"></script> <script type="application/javascript" src="https://rawgithub.com/angular-ui/ui-layout/v1.0.5/ui-layout.min.js"></script> <script> angular.module('x', ['ui.layout']); </script> </body> </html>
Further research shows that this is due to the absolute layout of the UI layout. If I add sytle:
<div ui-layout style="position:relative; height:500px">.
The user interface layout will no longer overlap with the navigation bar.
However, another problem arises, if the screen size changes, I need to manually change the height property of the style.
So, I am wondering if there is an easy way to handle this.
Thanks Derek
source share