bootstrap怎么实现自适应高度


本文摘自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》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...