Bootstrap div layout

Align div element to left or right

.pull-left floats an element left.


<!DOCTYPE HTML>
<html> 
<head> 
<link href="http://java2s.com/style/bootstrap.min.css" rel="stylesheet">
</head><!--from  w w  w .  j  a va2 s .  co m-->
<body style='margin:20px;'>

  <div class="pull-left">This is a test.</div>

</body>
</html>

Click to view the demo

.pull-right floats an element right


<!DOCTYPE HTML>
<html> 
<head> 
<link href="http://java2s.com/style/bootstrap.min.css" rel="stylesheet">
</head><!--from   w ww  .  j  ava  2 s.co  m-->
<body style='margin:20px;'>

 <div class="pull-right">This is a test.</div>

</body>
</html>

Click to view the demo

.clearfix clears the float on any element.


<!DOCTYPE HTML>
<html> 
<head> 
<link href="http://java2s.com/style/bootstrap.min.css" rel="stylesheet">
</head><!--from w  w  w.  j a  v a2s.  co m-->
<body style='margin:20px;'>

<div class="clearfix">this is a test.</div>


</body>
</html>

Click to view the demo





















Home »
  Bootstrap »
    Tutorial »




Bootstrap
Basic HTML Style
List
Table