bootstrap 预定义类clearfix和visible-xs-block

1.没使用预定义类的效果

<!doctype html>
<html lang="zh-cn">
<head>
	<meta charset="UTF-8">
	<title>bootstrap test</title>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum=1.0,maxmum=1.0,user-scalable=no">
	<link rel="stylesheet" href="./css/bootstrap.css">
</head>
<body>
<div class="container">
	<div class="row">
		<div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3Resize your viewport or check it out on your phone for an example.</div>
		<div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>
		<div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>
		<div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>
	</div>
</div>
<script src="./js/bootstrap.min.js"></script>
</body>
</html>
效果图:


2.使用预定义类

<!doctype html>
<html lang="zh-cn">
<head>
	<meta charset="UTF-8">
	<title>bootstrap test</title>
	<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum=1.0,maxmum=1.0,user-scalable=no">
	<link rel="stylesheet" href="./css/bootstrap.css">
</head>
<body>
<div class="container">
	<div class="row">
		<div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3Resize your viewport or check it out on your phone for an example.</div>
		<div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>
		<!-- Add the extra clearfix for only the required viewport -->
		<div class="clearfix visible-xs-block"></div>
		<div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>
		<div class="col-xs-6 col-sm-3">.col-xs-6 .col-sm-3</div>
	</div>
</div>
<script src="./js/bootstrap.min.js"></script>
</body>
</html>
效果图:


发布了25 篇原创文章 · 获赞 8 · 访问量 3万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章