- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
<style>
#header{border-bottom:1px solid blue;}
#footer{botter-top:1px solid blue;}
#header,#footer{height:15%;}
#content{height:70%;}
#header,#footer,#content{width:100%;}
</style>
<div id="header"></div>
<div id="content"></div>
<div id="footer"></div>
我注意到的是,在桌面浏览器中,有一个预期的溢出,从 100% 偏移 2px+但是,在移动浏览器中,似乎没有任何溢出/滚动。
最佳答案
所以是的,桌面浏览器会看到 2px 的偏移量,因为规范说采用 100% 的父级 + 边框 + 边距。移动浏览器似乎没有受到影响,但主要是因为它们试图将内容自动调整到窗口以消除滚动。
有 2 个 css3 修复,第一个是使用新的 box-sizing 属性,并将其设置为 border-box。第二种是使用flexbox模型。但不幸的是,较旧的浏览器可能不支持这两种解决方案。
所以我会使用 box-sizing,但是放入一个 IE 条件语句来说明 IE7 和返回,然后只使用 javascript 或 css hack 来修复它。
编辑
这里是使用 box-sizing http://jsfiddle.net/aaFHZ/ 的解决方案
body, html {height:100%; width: 100%;}
#header{border-bottom:1px solid blue;}
#footer{border-top:1px solid blue;}
#header,#footer{height:15%;}
#content{height:70%;}
#header,#footer,#content{width:100%; box-sizing:border-box;}
这里是 flexbox 的解决方案(注意:这只适用于最新的浏览器)http://jsfiddle.net/YkSYN/1/
<style>
body, html {height:100%; width: 100%;}
#header{border-bottom:1px solid blue;}
#footer{border-top:1px solid blue;}
#header,#footer {
-webkit-box-flex: 15;
-moz-box-flex: 15;
box-flex: 15;}
#content {
-webkit-box-flex: 70;
-moz-box-flex: 70;
box-flex: 70;}
#header,#footer,#content{width:100%;}
#wrapper {
display: -webkit-box;
-webkit-box-orient: vertical;
display: -moz-box;
-moz-box-orient: vertical;
display: box;
box-orient: vertical;
width: 100%;
height:100%;}
</style>
<div id="wrapper">
<div id="header"></div>
<div id="content"></div>
<div id="footer"></div>
</div>
关于html - border overflow 100% height width body 移动浏览器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12682549/
我想了解这两者的区别 谢谢 最大宽度:100px 宽度:100px body{ max-width: 1080px; width: 1080px; backgrou
jQuery 的 .width()、jQuery 的 .css('width') 和 .style 返回的值有什么区别.width 节点上的属性? 我很好奇,因为在尝试将两个表格单元格的宽度设置为相等
我可以在 wordpress 的 header php 中添加两个视口(viewport): 和 我希望能够使用 viewport width 1024 显示everything,除非您是低于 x
好的,所以我得到了 ImageBackground 的以下组件(使用 typescript ,但应该是不言自明的)。 (这是 react 原生的) import * as React from "re
我正在尝试根据 div 中包含的图像的宽度调整其大小,但没有任何 JS 方法可以一致地工作来获取图像的宽度。 label here img { width: auto
我有一个表,我试图找到表中每个 td 的宽度。我尝试了各种变体:$("td")[0].width(),但它们都不起作用,收到错误:"Uncaught TypeError: $ (...)[0].wid
我在使 rem 中的 min-width 与百分比宽度共存时遇到了一些问题。 When resizing this jsfiddle the outer right block is going un
当我在 chrome(以及 Edge/Brave/Opera)的设备模式下测试页面时,设备宽度属性似乎减少了,但宽度属性没有 重新创建: html {
我想依次显示 div #botone、#bottwo 和 #bottree。我还希望在 #botone div 上按 100% 宽度和比例高度调整背景图像。 现在最后两个 Div 显示在 #boton
我是第一次学习 JavaScript 的学生,我有一个学校问题,我们需要指出 width 和 style.width 接受的数据类型。 我知道数据类型有数字、字符串、空值、未定义、 bool 值和对象
所以看起来在移动设备中媒体查询使用 screen.width 根本没有改变。但是在我的桌面上,当我更改窗口大小时,screen.width 保持不变,$(window).width() 发生变化,并且
http://jsfiddle.net/3BFGU/27/ 有谁知道为什么包含文本“ABC”的跨度的宽度返回 0。 1) 仅在 Firefox 中发生。2)如果我删除两者之间的跨度,它工作正常。 (h
我知道下面的代码清除了 Canvas canvas.width = canvas.width 但这在内部是如何工作的呢? 赋值运算符只是将一些值赋给变量,但是上面的代码如何清除 Canvas ? 根据
当使用 max-width 时,为什么它不会“破坏”超过允许长度的单词,我该如何让它工作? JSFiddle function input() { var inputText = document
在移动网站上,在利用 width=device-width 视口(viewport)设置的同时调整文本大小的最佳方式是什么? 最佳答案 样式百分比如何?比如 100% 或 90%。 关于html -
对于我的 WPF Toolkit DataGrid,我使用以下自定义列标题样式:
过去,我看到下一个 css,我在想两者之间是否存在一些实际差异 min-width: 90px; max-width: 90px; 和 width: 90px; 最佳答案 使用 width 将简单地在
我有一个 R Markdown,我从 RStudio 中将其编织为 html。我可以使用 fig.width 和 fig.height 来调整我的绘图的分辨率,但我似乎无法加宽页面输出,以便文本输出不
此处的示例代码:http://pastebin.com/95z3pftQ 我正在尝试构建一个带有固定标题和“内容”部分的移动页面,该部分将填充外部(经过清理,但在其他方面是任意的)HTML。我需要使用
这里是 dp 单位的定义:(如果它是正确的...) 密度无关像素 - 一种基于屏幕物理密度的抽象单位。这些单位是相对于 160 dpi 屏幕而言的,因此 1 dp 是 160 dpi 屏幕上的一个像素
我是一名优秀的程序员,十分优秀!