Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS:流体侧栏-流体内容_Html_Css_Xhtml - Fatal编程技术网

Html CSS:流体侧栏-流体内容

Html CSS:流体侧栏-流体内容,html,css,xhtml,Html,Css,Xhtml,上图中解释了一切 基本上,我需要一个边栏div,其宽度根据其中的内容扩展,以及一个扩展到窗口其余宽度的mainContent。这似乎可以做到@不过,斯特凡说得有道理。侧栏将扩展到其文本的宽度,这意味着文本将不会换行。我想那可能不是你想要的。或者可能是这样,如果你放进去的东西变化不大,但也不是固定不变的 <html> <head> <style type="text/css"> #overallWrapper div { background: #CCC

上图中解释了一切


基本上,我需要一个边栏div,其宽度根据其中的内容扩展,以及一个扩展到窗口其余宽度的
mainContent

这似乎可以做到@不过,斯特凡说得有道理。侧栏将扩展到其文本的宽度,这意味着文本将不会换行。我想那可能不是你想要的。或者可能是这样,如果你放进去的东西变化不大,但也不是固定不变的

<html>
<head>
  <style type="text/css">
#overallWrapper div {
  background: #CCC;
  border: 1px solid black;
  padding: 15px;
  height: 100%;
}
#sideBar {
  float: left;
}
  </style>
</head>
<body>
  <div id="overallWrapper">
    <div id="sideBar">
      I need this to expand to the width of this text...
    </div>
    <div id="content">
      This should take the rest of the room, whatever's left...
    </div>
  </div>
</body>
</html>

#总包装部{
背景:#CCC;
边框:1px纯黑;
填充:15px;
身高:100%;
}
#边栏{
浮动:左;
}
我需要把这个扩展到文本的宽度。。。
这应该占去房间的其余部分,不管剩下什么。。。

如果需要,您可以卸下整体包装器。

这似乎可以做到@不过,斯特凡说得有道理。侧栏将扩展到其文本的宽度,这意味着文本将不会换行。我想那可能不是你想要的。或者可能是这样,如果你放进去的东西变化不大,但也不是固定不变的

<html>
<head>
  <style type="text/css">
#overallWrapper div {
  background: #CCC;
  border: 1px solid black;
  padding: 15px;
  height: 100%;
}
#sideBar {
  float: left;
}
  </style>
</head>
<body>
  <div id="overallWrapper">
    <div id="sideBar">
      I need this to expand to the width of this text...
    </div>
    <div id="content">
      This should take the rest of the room, whatever's left...
    </div>
  </div>
</body>
</html>

#总包装部{
背景:#CCC;
边框:1px纯黑;
填充:15px;
身高:100%;
}
#边栏{
浮动:左;
}
我需要把这个扩展到文本的宽度。。。
这应该占去房间的其余部分,不管剩下什么。。。

如果需要,您可以删除整体包装。

如果您关心左侧边栏的宽度,您可以将max-width-css属性应用于左侧div,以防您没有断行内联内容


另外,如果您支持具有最大宽度的ie7,请确保您的doctype是严格的。

如果您完全关心左侧边栏的宽度,您可以将最大宽度css属性应用于左侧div,以防您没有断行内联内容


另外,如果您支持最大宽度的ie7,请确保您的doctype是严格的。

这很好。有问题吗?还是只是一张工作单?我会回答一个问题,但我不会做你的工作。如果侧边栏根据其内容展开,它将扩展到100%宽度,其中包含一些文本行。也不是侧边栏的定义,很好。有问题吗?还是只是一张工作单?我会回答一个问题,但我不会做你的工作。如果侧边栏根据其内容展开,它将扩展到100%宽度,其中包含一些文本行。也不是侧边栏的定义。再完美不过了!谢谢你们,再完美不过了!谢谢你们。