Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.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/35.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 《英雄》中的内容中心化问题_Html_Css - Fatal编程技术网

Html 《英雄》中的内容中心化问题

Html 《英雄》中的内容中心化问题,html,css,Html,Css,我很难理解如何将这些内容集中在英雄身上。我希望内容集中在中间,垂直和水平。我希望解决方案是响应性的 下面是我正在寻找的一个例子: 这是我的html: <div class="Hero"> <div class="Hero_Container"> <h2 class="hero_header">Chef Prepared Meals.</h2> <h2 class="hero_header">Home Cooked Taste</

我很难理解如何将这些内容集中在英雄身上。我希望内容集中在中间,垂直和水平。我希望解决方案是响应性的

下面是我正在寻找的一个例子:

这是我的html:

<div class="Hero">
<div class="Hero_Container">
<h2 class="hero_header">Chef Prepared Meals.</h2> 
<h2 class="hero_header">Home Cooked Taste</h2>
<h3>Delivered Warm To Your Door</h3>
<button class="browse_menu_btn" href="/menus/">Browse This Week's Menu <br> Order Online</button>
<br>
<a href="/delivery">Check Our Dallas Delivery Area</a>
</div>  
</div>

任何帮助或建议都将不胜感激

假设要将div.Hero_容器居中,对于元素400px x 400px:

position: absolute; left: 50%; margin-left: -200px; top: 50%; margin-top: -200px; 位置:绝对位置; 左:50%; 左边距:-200px; 最高:50%; 利润上限:-200px;
我应该在问题中说明,我希望这是一个响应选项。恐怕我不知道位置的方法:垂直和水平居中的相对/响应布局,对不起。。。使水平居中的一种方法是设置左边距:自动,右边距:自动。我想你可以试试这样的 position: absolute; left: 50%; margin-left: -200px; top: 50%; margin-top: -200px;