Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.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 需要<;p>;填充高度<;部门>;帕伦特_Html_Css_Web - Fatal编程技术网

Html 需要<;p>;填充高度<;部门>;帕伦特

Html 需要<;p>;填充高度<;部门>;帕伦特,html,css,web,Html,Css,Web,我的总体目标是垂直居中一些文本。现在我有一个包含p的div。 分区为: .container{ margin-left: auto; margin-right: auto; height: auto; min-height: 100px; border: 1px solid red; width: 60%; overflow: hidden; } 而p: .welcome_title{ float: left; width: 30%; height: 100%; min

我的总体目标是垂直居中一些文本。现在我有一个包含p的div。 分区为:

.container{
 margin-left: auto;
 margin-right: auto;
 height: auto;
 min-height: 100px;
 border: 1px solid red;
 width: 60%;
 overflow: hidden;
 }
而p:

.welcome_title{
 float: left;
 width: 30%;
 height: 100%;
 min-height: 100%;
 font-size: 200%;
 vertical-align: middle;
 text-align: center;
 }

这样做的目的是使p的高度100%显示在屏幕上,而不是显示在屏幕上。有什么帮助吗?

除非使用显示:表格单元格

我不知道为什么你的欢迎标题是浮动的左边,如果浮动是必要的,但在这里你会发现三个例子。我相信你会找到一个适合你需要的


添加
position:relative
。container
垂直对齐属性仅适用于表格单元格或内联元素,浮动元素两者都不适用。此外,欢迎你的标题听起来不太像典范,它听起来像一个标题…这是不是“让p的高度在屏幕上占100%?”?还有一个问题。。是否可以使表格单元格成为动态的?