本文摘自PHP中文网,作者angryTom,侵删。
如果你想了解更多的关于bootstrap的知识,可以点击:bootstrap教程
很多人会使用boot的栅格化布局,但是高度却不知道怎么等比例控制,本文就详细介绍使用bootstrap框架构建前端页面时如何控制元素高度自适应布局。
首先我们在页面头部引用一段JS
js代码片段如下:
1 2 3 4 5 | var iScale = 1;
iScale = iScale / window.devicePixelRatio;
document.write( '<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=' + iScale + ',minimum-scale=' + iScale + ',maximum-scale=' + iScale + '">' )
var iWidth = document.documentElement.clientWidth;
document.getElementsByTagName( 'html' )[0].style.fontSize = iWidth / 16 + 'px' ;
|
注意:要在文档加载前引入,否则不生效。
阅读剩余部分
相关阅读 >>
bootstrap-select下拉框如何清除选中的状态?
html如何引用bootstrap
css中的bootstrap是指什么
bootstrap有什么ui框架?
统计学bootstrap用于解决什么问题
不用bootstrap用什么
jquery easyui和bootstrap的区别是什么
bootstrap如何给div设置边框颜色
关闭bootstrap alert提示窗的实现方法
简述为什么要使用bootstrap,有什么优点
更多相关阅读请进入《bootstrap》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » bootstrap怎么实现自适应高度