【问题标题】:height 100% and min-height collapsing in chrome高度 100% 和最小高度在 chrome 中折叠
【发布时间】:2014-03-09 12:01:12
【问题描述】:

我正在尝试将内部子 div 拉伸到窗口的剩余大小,同时将其限制为最小高度。请看这个笨蛋http://plnkr.co/edit/AxmB8RoYKY95GQqOVG7h?p=preview

子 div 延伸到剩余空间,它并没有像预期的那样小于最小高度,但仅在 Firefox 和 IE 中。当我在 Chrome 中对此进行测试时,拉伸的 div 会在达到最小高度时折叠。

样式有问题还是有解决方法?

这是我测试的浏览器版本: Firefox:27、IE 11 和 Chrome 32

【问题讨论】:

  • 我现在在 Safari 中试了一下,结果和 chrome 一样,所以它与 web-kit 有关。
  • 问题不清楚!!!
  • @sanjeev 问题是如何修复样式,以便 div 在 chrome 中的行为与在 Firefox 或 IE 中的行为相同。或者当达到最小高度时,为什么 div 会在 chrome 中折叠。

标签: css html


【解决方案1】:

如果它在其他浏览器中工作,它可能是一个仅限 chrome 的项目,因为 html 中没有“标准”,每个浏览器都有它自己的预构建 css。它们中的大多数看起来很标准,但有时它们会引起问题。

您可以尝试使用此代码执行 css 重置,这对我去年正在从事的项目很有用。

/* http://meyerweb.com/eric/tools/css/reset/ 
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}

【讨论】:

  • 我在页面中添加了重置,但它没有解决问题,反正坦克
猜你喜欢
  • 1970-01-01
  • 2017-07-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-02-03
  • 2010-12-18
  • 2021-03-11
相关资源
最近更新 更多