Bootstrap clearfix style


  Translation results:

clear

UK[klɪə(r)] US[klɪr]

adj. Clear; clear; clear, clear; clear, bright

adv.completely; clearly; whole

vi.become clear; become clear

vt.sweep, remove; eliminate (suspect); make clear; Make clean

n. Gap, space

fix

英[fɪks] 美[fɪks]

vt.Fix; Repair; prepare; make firm

vi. Fix; harden; stabilize

n. Dilemma; Positioned; Things under control; Emergency measures

Bootstrap clearfix stylesyntax

Function: Clear floating

Bootstrap clearfix styleexample

<!DOCTYPE html>
<html>
<head>
  <title>Bootstrap .clearfix 实例</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">  
  <script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
  <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container-fluid">
  <h1>Hello World!</h1>
  <div class="row">
    <div class="col-xs-6 col-sm-3" style="background-color:lavender;">
      列 1<br>
      重置窗口大小,查看效果。也尝试删除有 clearfix  的 div 查看效果。
    </div>
    <div class="col-xs-6 col-sm-3" style="background-color:lavenderblush;">列 2</div>
    <!-- Add clearfix for only the required viewport -->
    <div class="clearfix visible-xs"></div>
    <div class="col-xs-6 col-sm-3" style="background-color:lightcyan;">列 3</div>
    <div class="col-xs-6 col-sm-3" style="background-color:lightgray;">列 4</div>
  </div>
</div>
</body>
</html>
Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A