我准备在我的页面尖叫,感觉像是一场真正的战斗。我正在尝试为html应用程序获取完整页面布局。我试图让两个主要的div并排,我可以用js隐藏。我在每个div内都有一个44px的标题。我的问题是,我似乎无法阻止大量内容流入第一个div,即使溢出隐藏等。我无法发布所有代码,但我应该可以发布相关部分。大部分代码与问题无关。为了更容易看到,我制作了JSfiddle。提前致谢。哦,还有一些关于让我的投票回答的提示。不要试图改变列的宽度,我需要它们灵活的边界。提前致谢!Div尽管可用空间下降
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="style.css" rel="stylesheet">
<title>Stack Overflow</title>
</head>
<body>
<div id="page-holder">
<div id="main-menu" class ="menu-width">
<div class="wide vert-center-right header large">
<div>
<input id="search" type="text" class="search"/>
<img class="visible-phone" src="css/images/logo.png" />
</div>
</div>
<div id="menu-body" class="menu-body">
<button class="wide small vert-center-left">Push Me</button>
</div>
</div>
<div id="main-view" class="view-width">
<div id="view-header" class="header view-header vert-align-left">
<a href="#" class="visible-phone" onclick="resized()"><img class="plain" src="css/images/header-icon-back-18x18.png"/></a>
<img src="css/images/header-logo.png" />
</div>
<div id="view-body" class="view-body">
Large block of text that I want to not wrap into menu column. Large block of
text that I want to not wrap into menu column. Large block of text that I want
to not wrap into menu column. Large block of text that I want to not wrap into
menu column. Large block of text that I want to not wrap into menu column.
Large block of text that I want to not wrap into menu column. Large block
of text that I want to not wrap into menu column. Large block of text that
I want to not wrap into menu column. Large block of text that I want to not
wrap into menu column. Large block of text that I want to not wrap into menu
column. Large block of text that I want to not wrap into menu column. Large
block of text that I want to not wrap into menu column. Large block of text
that I want to not wrap into menu column. Large block of text that I want to
not wrap into menu column. Large block of text that I want to not wrap into
menu column. Large block of text that I want to not wrap into menu column.
Large block of text that I want to not wrap into menu column.
</div>
</div>
<div style="clear:both"></div>
</div>
</body>
</html>
嗯,我不能够复制这一结果与浮子#主视图,至少不会在IE中,我的猜测是不是文本最好的浏览器进行测试,除了我希望也能够将其用于Windows 8应用程序,我很确定使用ie引擎。至于填充,由于菜单列的min,max和%,就我所知,这不是css可解的。你能编辑我的jsfiddle来显示你的工作解决方案吗? – rickstockham 2013-03-07 18:52:04
在试图修复宽度时,您仍然可以使用填充 - 只需使用“box-sizing:border-box”即可。 ;)刚刚编辑我的答案,检查新的小提琴。 – Terry 2013-03-07 18:55:10
我不确定你是否与视图大小混淆,但这不是一个正确的解决方案。如果我可以用桌子做,我会很开心,但内容会变得疯狂。我知道它是一个棘手的问题,它可能需要一个沉重的JS解决方案。 – rickstockham 2013-03-07 19:06:44