html - Bootstrap : responsive div in between two fixed div elements

标签 html css twitter-bootstrap responsive-design

我有一个响应 <div>元素放置在两个固定 <div> 之间元素。我尝试了以下代码:

 <html>
 <head>
 <title>Sample1</title>
 <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.min.css">
 </head>
 <body>
     <div style="width: auto">
         <div style="float: left; width:270px; background-color: green">Fixed div</div>
         <div style="float: right; width: 120px; background-color: yellow"> Fixed div</div>
         <div style="background-color: red" class="row">Responsive div</div>        
     </div>
</body>
</html>

当前响应<div>元素占据了整个屏幕。当我尝试检查宽度和高度时,它已经获取了我的整个主 <div> .有什么方法可以让我把这个响应 <div>里面 2 固定 <div>

最佳答案

检查下面的代码:这里我改变了Div的顺序,改变了三者的显示样式。

<html>
 <head>
   <title>Sample1</title>
   <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.min.css">
 </head>
 <body>
  <div style="display:table; width:100%">
    <div style="display:table-cell; width:270px; background-color: green">Fixed div </div>
    <div style="background-color: red; display:table-cell;"> Responsive div </div>
    <div style="display:table-cell; width: 120px; background-color: yellow"> Fixed div</div>
  </div>
</body>
</html>

关于html - Bootstrap : responsive div in between two fixed div elements,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29959835/

相关文章:

html - 如何防止两列内容重叠

html - 适合图像 Bootstrap 周围的边框

javascript - 使用 extract-text-webpack-plugin 和在 HTML header 中链接合并的 CSS 文件有什么区别?

html - 图片上的HTML5音频请点击

css - Eclipse插件自动编译Sass文件

HTML/CSS 背景色

twitter-bootstrap - Twitter bootstrap 和 Angular.js 之间真正(或隐藏)的区别

javascript - 用中文/日文字符对齐 html 文本

html - 我如何在 css :before { content: }? 中使用这个 UTF 8 形状

html - 使用CSS将图像保持在中间