Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.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/41.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 在快速响应中,在图像上垂直和水平对齐内容DIV的最佳方法是什么_Html_Css_Twitter Bootstrap_Responsive Design - Fatal编程技术网

Html 在快速响应中,在图像上垂直和水平对齐内容DIV的最佳方法是什么

Html 在快速响应中,在图像上垂直和水平对齐内容DIV的最佳方法是什么,html,css,twitter-bootstrap,responsive-design,Html,Css,Twitter Bootstrap,Responsive Design,在响应中,在图像上垂直和水平对齐内容DIV的最佳方法是什么。我可以给出绝对位置和对齐顶部:部分%,和左侧:部分%,但在某些屏幕中它不会对齐图像容器的中间,我可以给出页边距顶部:-%,margin left:some%在不同的屏幕中,此选项有时也无法正确对齐。是否有其他方法可以做到这一点。content div应该精确地放置在图像的中间位置(在所有屏幕中水平和垂直)。最好的方法是什么 <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"&g

在响应中,在图像上垂直和水平对齐内容DIV的最佳方法是什么。我可以给出绝对位置和对齐
顶部:部分%
,和
左侧:部分%
,但在某些屏幕中它不会对齐图像容器的中间,我可以给出
页边距顶部:-%
margin left:some%
在不同的屏幕中,此选项有时也无法正确对齐。是否有其他方法可以做到这一点。content div应该精确地放置在图像的中间位置(在所有屏幕中水平和垂直)。最好的方法是什么

<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
   <img src="img/someimage.png" class="img-responsive">
   <div class="content_div">
       image content paragraph 1
       image content paragraph 1
       image content paragraph 1
   </div>
</div>

图像内容第1段
图像内容第1段
图像内容第1段

内容div必须放在图像的中间

  <div class="container">
    <img goes here>
    <div text goes here>
  </div>
它会帮助你的

另一种方法是

  set table layout for div and table-cell for content which will support vertical-align:middle`
编辑:

这会对你有帮助的


由于

我无法确定
容器的宽度和高度
,因此我无法在
px
中给出行高,然后再进行表格布局。谢谢回复。我的问题是我无法确定
高度
,但我可以使
宽度:100%
。高度应该是自动的,宽度应该是100%。只有响应性好。哦,来吧,伙计。把它换成小提琴,检查一下。好极了,让我们一起去吧。
  set table layout for div and table-cell for content which will support vertical-align:middle`