html - 高度:vh;在移动 chrome 中无法正常工作

标签 html css height viewport

Chrome 没有根据视口(viewport)调整内容

在 firefox 中完美运行

我也在 Opera mini 上测试过它,它也能正常工作。但我不能发布超过 2 个链接

Chrome

Firefox

chrome有没有可能像opera和firefox一样适配?

.intro-noticias {
  width: 100%;
  height: 89vh;
  margin-top: 70px;
}

.intro-noticia-1 {
  width: 50%;
  height: 100%;
  float: left;
  border-right: 2px solid #000;
  position: relative;
}

@media only screen and (max-width: 500px) {
 .intro-noticia-1 {
  width: 100%;
  height: 100%;
  border-bottom: 2px solid #000;
}

}
<div class="intro-noticias">	
	<div class="intro-noticia-1">
	 	<a href="#">
		<div class="intro-post-thumbnail">
		<div class="intro-noticia-main-caption">
			<h2></h2>
		<div>
			<span class="intro-main-caption-autor"></span>
			<span class="intro-main-caption-time"></span>
	  </div>
	 </div>
	 </div></a>
	</div>
 </div>

最佳答案

会不会是您的 margin-top 将其丢弃? Calc 可能是解决方案

.intro-noticias {
  width: 100%;
  height: calc(100vh - 70px); /* The full view port height minus the margin */
  margin-top: 70px;
}

关于html - 高度:vh;在移动 chrome 中无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42307096/

相关文章:

jquery - iPhone (jQuery) 的高度错误?

javascript - 向动态表添加固定表头

html - 在查询字符串中传递电子邮件地址

css - 使用具有最大高度的计算器

css - 较低分辨率的 Bootstrap 布局

css - 如何在 Web 应用程序中渲染多个尺寸的同一图像?

iOS - 如何使用自动布局调整 View 大小?

javascript - canvas.style.display = "block"不工作

html - 自动保存对 Chrome 开发工具中现有样式所做的 CSS 更改?

html - 将 CSS 规则应用于与多个可能属性值之一匹配的元素