您可以像这样使用table属性vertical-align(在您的示例中):
html:
<div class="bg_class">
<div class="bg_class_inner">
My text goes here...My text goes here...My text goes here...
My text goes here...My text goes here...My text goes here...
My text goes here...My text goes here...My text goes here...
My text goes here...My text goes here...
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
css:
.bg_class
{
background: green;
width: 300px;
height: 200px;
text-align: center;
margin: 0 auto;
display: table;
}
.bg_class_inner
{
display: table-cell;
text-align: center;
vertical-align: middle
}
Run Code Online (Sandbox Code Playgroud)