本文摘自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定义上弹菜单
bootstrap和layui的区别
bootstrap命令是什么意思
vue cli3引入bootstrap的方法介绍
如何使用bootstrap实现年月日的时间选择
bootstrap如何学习
bootstrap怎么关闭弹出层
深入了解bootstrap中的媒体对象
bootstrap怎么设置背景图片
bootstrap基于什么开发
更多相关阅读请进入《bootstrap》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » bootstrap怎么实现自适应高度