- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在这个网站(和其他网站)上做了很多研究,但我无法解决我的问题……在这个网站上:http://vintagebike.fr/t%C3%A9t%C3%A9/我希望每个部分都覆盖视口(viewport)高度的 100%……我设置了最小高度:每个 100%……我设置了 html,body 的高度:100%
一些代码:
html{ overflow-y:scroll; font-size:100%; font-family:Arial,Helvetica,sans-serif; line-height:1.5; background:url(...) repeat top left; font-color:#353232; height:100%;}
body{ height:100%; background:#fff; float:left; width:100%; font-size:.8125em; color:#353232;}
#about{background-color: #cde2f3;position:relative;min-height:100%;}
#elements{background-color: #fbe2e4;position:relative;min-height:100%;}
#pourqui{background-color: #ffedc1;position:relative;min-height:100%;}
#contact{background-color: #ddeee4;position:relative;min-height:100%;}
如果我以像素为单位设置高度,它就可以工作......
我真的不明白......
提前致谢。
(对不起我的英语)
最佳答案
阅读 percentage height 的规范.它与视口(viewport)无关。由于您有 body {height:100%}
,随着 BODY 的增长,它成为用于表示 100% 的元素,而不是视口(viewport)。
您需要根据浏览器的视口(viewport)大小使用 JavaScript 设置部分高度。
好机会。
Specifies a percentage height. The percentage is calculated with respect to the height of the generated box's containing block. If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the value computes to 'auto'. A percentage height on the root element is relative to the initial containing block. Note: For absolutely positioned elements whose containing block is based on a block-level element, the percentage is calculated with respect to the height of the padding box of that element. This is a change from CSS1, where the percentage was always calculated with respect to the content box of the parent element.
关于height - 覆盖视口(viewport) 100% 高度的部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14737921/
我想检测鼠标何时离开顶部的视口(viewport)(可以说是向北)。我在网上搜了下How can I detect when the mouse leaves the window? .是一个好的开始
我有一个 HTML 元素,宽 1000 像素,高 850 像素(它实际上是一个 iFrame,在 canvas 标签上包含一个 HTML5 游戏,但我希望这不会有影响)。 我希望元素在平板电脑上呈现,
我正在创建一个 2D 引擎,我想实现对接,所以我需要创建一个视口(viewport)并将屏幕渲染为纹理。 为了渲染视口(viewport),我将帧缓冲区保存到一个 FrameBufferObject
大多数移动页面都提供元视口(viewport)尺寸,例如 出于 iphone 向后兼容的原因,这将在宽度上模拟 320px... 但是当我通过 javascript 检查时 window.screen
我有一个客户提供的宽度为 1440 像素的网站。客户要求我使用以下方法将视口(viewport)设置为 1440 像素对于桌面浏览器,小于 1440 像素的屏幕不显示滚动条。 它确实适用于移动设备、i
我刚刚读了一篇 nice article on viewport这给我留下了几个关于移动设备上的视觉视口(viewport)与布局视口(viewport)的问题。 the width and the
layout viewport和visual viewport的解释可以找到here . 我已阅读 here和 here那个应该使用 如果想针对移动设备优化网页。 我想了解这对横向模式下的 ipho
我想用javascript获取视口(viewport)宽度。但不是常见的虚拟视口(viewport)。我需要逻辑硬件视口(viewport),在我的情况下,它不是设置视口(viewport)元标记的选
我有一个 menu 元素,如果 menu 元素变得在视口(viewport)之外,我想固定到浏览器视口(viewport)的顶部由于滚动。从概念上讲,我的网页看起来类似于下面的示例 HTML,其中菜单
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 4 年前。 Improve this qu
我只包含了“main”的 HTML 代码,因为这是我希望能够通过媒体查询控制的部分。我希望内容只能在小于 480 像素的视口(viewport)上查看,但浏览器似乎隐藏了所有视口(viewport)尺
我不知道如何描述这个,所以最好的办法是链接一个例子:http://www.pascalvangemert.nl/#/profile 无论这个人对侧边栏菜单做了什么都很棒,我很想复制它。我试过检查,但我
我遇到了一页末尾有空白的问题。据我所知,没有元素占据空间。仅当视口(viewport)设置为特定宽度时才会出现该空间。例如,它出现在宽度 940 和 400 左右,但不是 550 或非常宽。 起初我以
iPhone/iPad 等移动设备的视觉视口(viewport)和布局视口(viewport)有什么区别? 网上查了很多资料,还是不清楚。 最佳答案 视觉视口(viewport)是当前显示在屏幕上的页
我正在使用这个元标记来设置移动浏览器上的视口(viewport)大小: 和这个 css 以确保较大的图像不会导致在较小的视口(viewport)上滚动: img { max-width: 95%;
这是针对平板电脑浏览器的,它使用相对于视口(viewport)宽度/高度的尺寸。为简单起见,假设横向。 我在一个全屏容器中有两个 div,就像提供的图像一样。他们有 position:absolute
我在 opengl 中创建了一个迷宫,并且正在尝试创建一个小 map 。为此,我想到在视口(viewport)内创建一个视口(viewport)。我有三种方法,一种用于创建墙壁,另一种用于创建地板,另
所以我有 2 个屏幕:一个级别选择屏幕,使用分辨率为 720 x 405 的 FitViewport,然后是一个游戏屏幕,使用分辨率为 480 x 270 的 FillViewport,按每米像素数
无论视口(viewport)的宽度如何,我都有一个图像幻灯片,我试图将其置于视口(viewport)的中心。如果视口(viewport)比图像宽,使用 margin: auto; 很容易实现,但是,当
我有一个元素,该元素具有从屏幕边缘底部弹出并循环向下弹出(虽然不是完全向下)的动画。下面的代码对此非常有用。但是,有一个问题。当浏览器全屏显示时,百分比占旧视口(viewport)大小而不是新视口(v
我是一名优秀的程序员,十分优秀!