我想把两个div放在一起。一个居中,一个居中但向右偏移。这不是重复,因为我不想将第二个div对齐。我需要将它与中心偏移对齐。
这是我的代码,我不能让文本垂直对齐,也不能使第一个div居中。
HTML:
<div class="consents-container">
<div class="consent-container">
<div class="consent-text">
This is a long all centered text<\br>
with two lines
</div>
<div class="consent-interaction">
This is X Pixels offst to the right from center
</div>
</div>
<div class="consent-container">
<div class="consent-text">
This is a long all centered text<\br>
with two lines
</div>
<div class="consent-interaction">
This is X Pixels offst to the right from center
</div>
</div>
</div>
CSS:
.consents-container{
z-index: 10000;
width: 100%;
}
.consent-container{
width: 100%;
background-color: #FBBB01;
margin-bottom: 2px;
min-height: 50px;
}
.consent-text{
background-color: blue;
display: inline-block;
width: 40%;
line-height: normal;
}
.consent-interaction{
background-color: red;
display: inline-block;
width: 20%;
}