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-select下拉框如何清除选中的状态?

html如何引用bootstrap

css中的bootstrap是指什么

bootstrap有什么ui框架?

统计学bootstrap用于解决什么问题

不用bootstrap用什么

jquery easyui和bootstrap的区别是什么

bootstrap如何给div设置边框颜色

关闭bootstrap alert提示窗的实现方法

简述为什么要使用bootstrap,有什么优点

更多相关阅读请进入《bootstrap》频道 >>




打赏

取消

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

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

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

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

评论

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