本文摘自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区别
bootstrap属于js框架吗
浅谈bootstrap blazor组件的用法
bootstrap被淘汰了吗
bootstrap有什么优点
bootstrap响应式布局图片怎么居中
bootstrap less是什么
bootstrap怎么把div变成一个圆
更多相关阅读请进入《bootstrap》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » bootstrap怎么实现自适应高度