.navbar-left 또는 .navbar-right 유틸리티 클래스를 사용하여 탐색 링크, 양식, 버튼 또는 텍스트와 같은 구성 요소를 탐색 모음에서 왼쪽이나 오른쪽으로 정렬합니다. 두 클래스 모두 지정된 방향으로 CSS float를 추가합니다.
예시
다음 코드를 실행하여 구성요소를 정렬할 수 있습니다.
<!DOCTYPE html> <html> <head> <title>Bootstrap Example</title> <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet"> <script src = "/scripts/jquery.min.js"></script> <script src = "/bootstrap/js/bootstrap.min.js"></script> </head> <body> <nav class = "navbar navbar-default" role = "navigation" style="background: orange;"> <div class = "navbar-header"> <a class = "navbar-brand" href = "#">Alignment</a> </div> <div> <!--Left Align--> <ul class = "nav navbar-nav navbar-left"> <li class = "dropdown"> <a href = "#" class = "dropdown-toggle" data-toggle = "dropdown"> Java <b class = "caret"></b> </a> <ul class = "dropdown-menu"> <li><a href = "#">jmeter</a></li> <li><a href = "#">EJB</a></li> <li><a href = "#">Jasper Report</a></li> <li class = "divider"></li> <li><a href = "#">Separated link</a></li> <li class = "divider"></li> <li><a href = "#">One more separated link</a></li> </ul> </li> </ul> <form class = "navbar-form navbar-left" role = "search"> <button type = "submit" class = "btn btn-default">Left align-Submit Button</button> </form> <p class = "navbar-text navbar-left">Left align-Text</p> <!--Right Align--> <ul class = "nav navbar-nav navbar-right"> <li class = "dropdown"> <a href = "#" class = "dropdown-toggle" data-toggle = "dropdown"> Java <b class = "caret"></b> </a> <ul class = "dropdown-menu"> <li><a href = "#">jmeter</a></li> <li><a href = "#">EJB</a></li> <li><a href = "#">Jasper Report</a></li> <li class = "divider"></li> <li><a href = "#">Separated link</a></li> <li class = "divider"></li> <li><a href = "#">One more separated link</a></li> </ul> </li> </ul> <form class = "navbar-form navbar-right" role = "search"> <button type = "submit" class = "btn btn-default"> Right align-Submit Button </button> </form> <p class = "navbar-text navbar-right">Right align-Text</p> </div> </nav> </body> </html>