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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.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_Twitter Bootstrap 3 - Fatal编程技术网

Html 如何将文本垂直居中对齐?

Html 如何将文本垂直居中对齐?,html,css,twitter-bootstrap-3,Html,Css,Twitter Bootstrap 3,我有这个网站: 正如你所看到的,我的文本并没有像应该的那样垂直对齐。 我希望在所有决议中都能做到更低和相同 这是html代码: <div class="entry-content2"> <div class="gigi"> <div class="row"> <div class="col-sm-12 col-md-12 col-lg-12 style=" "=""> <img src="wp-co

我有这个网站:

正如你所看到的,我的文本并没有像应该的那样垂直对齐。 我希望在所有决议中都能做到更低和相同

这是html代码:

    <div class="entry-content2">

<div class="gigi">

  <div class="row">
    <div class="col-sm-12  col-md-12  col-lg-12  style=" "="">
       <img src="wp-content/themes/WordPressBootstrap-master/images/LOGOb.png" class="img-responsive center-block" style="min-width:156px;min-height:83px">
    </div>
   </div>
</div>
        <div class="container-fluid aliniere">
<p class="text-center" style="color:white;font-size:17px;padding-left:50px;padding-right:50px;padding-top:20px;padding-bottom:20px;">Am reprezentat şi am acordat consultanţă juridică pentru clienţi persoane fizice române şi străine, instituţii publice, persoane juridice române şi străine în următoarele domenii:</p>
<div class="row sss">
<div class="col-sm-4 col-md-4 col-lg-3 col-lg-offset-2" style="font-size:17px;color:white;">
<p class="text-left">Drept civil<br>
– agricultură, exploatări agricole, prelucrarea şi comercializarea produselor agricole;<br>
– comerţ cu produse alimentare;<br>
– imobiliar;<br>
– distribuţie de carburanţi;<br>
– transporturi;<br>
– asigurări;<br>
– producţie şi comercializare utilaje grele;<br>
– producţie structuri metalice;<br>
– design, fotografie, artă;
</p>
<p></p></div>
<div class="col-sm-4 col-md-4 col-lg-3 col-lg-offset-0" style="font-size:17px;color:white;">
<p class="text-left">Drept administrativ<br>
– producţie automatizări;<br>
– servicii de proiectare;<br>
– comercializare automatizări;<br>
– jocuri de noroc;<br>
– turism, hoteluri şi pensiuni;<br>
– medical;<br>
– construcţii civile şi industriale;<br>
– comercializare utilaje şi autovehicule, service auto;<br>
– producţie software, administrarea site-urilor; </p>
<p></p></div>
<div class="col-sm-4 col-md-4 col-lg-3 col-lg-offset-0" style="font-size:17px;color:white;">
<p class="text-left">
– comerţ;<br>
– bursier, societăţi listate, investitori, fonduri de investiţii;<br>
– asistenţă şi îngrijire copii şi vârstnici;<br>
– exploatări forestiere şi prelucrarea lemnului;<br>
– extracţia şi prelucrarea minereurilor;<br>
– producţia şi comercializarea materialelor de construcţii;<br>
– instituţii publice;<br>
– instituţii religioase.</p>
<p></p></div>
<p></p></div>
</div>
    </div>
你能帮我解决这个问题吗

我找到了这个例子,但我们没有实现它,所以我打电话给您的帮助

提前谢谢

您可以使用display:table;在父容器和display上:将表格单元格添加到需要垂直对齐的子元素

还显示:表格;非常支持跨浏览器:


JSFIDDLE

在CSS中,我们在处理表时有一些不同的东西,在表中它具有垂直对齐属性。如果可以更改元素的显示,则可以将其设置为类似于表格单元格的行为,在表格单元格中可以垂直对齐

在这里,请检查此链接:


这将始终使您的文本垂直居中。

您是否尝试过上面JSFIDLE上显示的内容?上面发布的示例仅在一种情况下有效,当您知道div的高度时。未知高度的给定解决方案将不起作用。在这种情况下可以做什么?是的,我理解您的示例,但无法为我实现它。。。offI在你发布的网站上看到了代码,它充满了固定设置的边距/填充。删除这些内容并将父容器应用为显示:表格,子容器应用为显示:表格单元格和垂直对齐:中间。给body和html标记100%的高度,然后将高度百分比应用于div。我应该在哪里删除填充和边距?哪个是id类?显示:必须应用表元素。entry-content2?显示:表格单元格和垂直对齐:中间应适用于.rowsss@media屏幕和最小宽度:1200px.sss{右侧填充:100px;底部填充:20px;}例如。。。。删除这些:如果添加固定的右侧填充,它将永远不会居中:
body,html{
    height:100%;
}

div {
  width: 250px;
  height:100%;
  display: table;
  text-align: center;
  border: 1px solid #123456;
  margin-bottom:5px;
}
span {
  display: table-cell;
  vertical-align: middle;
  line-height: normal;
}
.something-semantic {
  display: table;
  width: 100%;
}
.something-else-semantic {
  display: table-cell;
  text-align: center;
  vertical-align: middle;
}