Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.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 Bootstrap 4.0-带图像的响应标头+;导航栏+;全高车身_Html_Css_Twitter Bootstrap_Bootstrap 4 - Fatal编程技术网

Html Bootstrap 4.0-带图像的响应标头+;导航栏+;全高车身

Html Bootstrap 4.0-带图像的响应标头+;导航栏+;全高车身,html,css,twitter-bootstrap,bootstrap-4,Html,Css,Twitter Bootstrap,Bootstrap 4,我正在用bootstrap 4构建一个响应页面,其中有一个标题/标题部分,其中包含客户的徽标、名称和导航栏的图像。所有这些元素都是响应性的,即图像根据屏幕大小缩小,导航栏在小屏幕上最小化 现在我想让身体也有一个响应的方式。i、 e:用内容填充屏幕的剩余高度,必要时使用滚动条显示所有内容。 但由于某些原因,我无法理解如何在整个高度上跨越页面的其余部分。它要么在某些更大的屏幕上太大(当它非常适合移动设备时),要么完全适合大屏幕,但只有移动设备上应有高度的一半 该页面大致采用以下结构构建: <!

我正在用bootstrap 4构建一个响应页面,其中有一个标题/标题部分,其中包含客户的徽标、名称和导航栏的图像。所有这些元素都是响应性的,即图像根据屏幕大小缩小,导航栏在小屏幕上最小化

现在我想让身体也有一个响应的方式。i、 e:用内容填充屏幕的剩余高度,必要时使用滚动条显示所有内容。
但由于某些原因,我无法理解如何在整个高度上跨越页面的其余部分。它要么在某些更大的屏幕上太大(当它非常适合移动设备时),要么完全适合大屏幕,但只有移动设备上应有高度的一半

该页面大致采用以下结构构建:

<!DOCTYPE html>
<html lang="de" style="height:100%">

<head>
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <title>Client Name</title>
</head>

<body class="main" style="height:100%">
  <div class="container">
    <div class="text-center">
    <!-- Client image goes here -->
    <h1 style="display:inline;margin-left:0.6em;color:#8b7d7b">Client Name</h1>
   </div>
  </div>
  <nav class="navbar navbar-expand-lg navbar-light" style="background-color:#e0eee0">
    <button class="navbar-toggler collapsed" type="button" data-toggle="collapse" data-target="#mainnavbar" aria-controls="mainnavbar" aria-expanded="false" aria-label="Toggle Navigation">
  <span class="navbar-toggler-icon"></span>
</button>
<div id="mainnavbar" class="navbar-collapse collapse justify-content-md-center">
  <ul class="navbar-nav">
    <li class="nav-item nav-link active">Page A</li>
  </ul>
</div>
</nav>
<div class="container" style="height:70vh">
<div class="row" style="height:100%">
  <!-- Main body of page -->
  <div class="col-sm-1 col-md-9" style="height:100%">
    <p class="col-scrol">
      <!-- Main part of the page. Content should have full height and scroll vertically if necessary -->
    </p>
  </div>
  <!-- Comment section (scrolling) -->
  <div class="d-none d-md-block col-md-3 comment-section">
        <!-- Comment section at the left hand side of the page -->      
  </div>
 </div>
 </div>
</body>

</html>

客户名称
客户名称
  • 第A页

我创建了一个plunkr,它实际上显示了整个页面:

使用bootstrap 4.0,根据需要显示页面的正确方法是什么,即使用图像根据屏幕大小缩小/增大时留下的完整剩余高度

编辑以澄清:

内容本身应该有一个滚动条,而不是整个页面。即,带有图像和菜单栏的标题应始终可见,而随后出现的内容应具有滚动条(如有必要)。

使用flexbox使内容区域填充其父容器(本例中为主体)的高度,而不是设置定义的高度

注意:flex fill实用程序类将包含在下一个Bootstrap 4.2版本中:


类似问题:



请回答:如果您想使用Bootstrap 4,为什么代码会引用Bootstrap 3?您是对的。我很抱歉。在这里和Plunkr示例中修复了这个问题。我下载了这些文件以在本地包含它们,因此我不得不用在线文件替换这些文件,并且使用了错误的URL。这个问题的实际问题仍然适用。很抱歉,我的问题似乎陈述不正确。我将编辑这个问题。滚动条应仅用于内容,而不是标题或菜单。也就是说,标题和菜单应该保持在页面顶部,并且始终可见。如前所述,仍然可以使用flexbox完成。看看我贴的其他类似问题,答案是:太好了,明白了。非常感谢你。
body {
    display:flex;
    flex-direction:column;
}

.flex-fill {
    flex: 1 1 auto;
}

.flex-shrink {
    flex-shrink: 0;
}