在 div 元素中有标题、价格和单位(克)。我希望价格总是在标题第一行旁边的右上角(参见示例),无法获得,总是在标题之后。
<div class="info-block">
<p style="font-size: 18px; margin-top: 18px; margin-left: 10px;"><span class="title"><?=$last['title']?></span></p>
<p style="font-size: 18px; margin-right: 10px; float:right;"><span class="price"><?=$last['price']?></span> тг.</p>
</div>
谢谢,阿里
此解决方案似乎有效:
.left{
display: inline-block;
width: 70%
}
.right{
display: inline-block;
float: right;
width: 30%
}
<div class='parent'>
<div class='left'>This should be on the leftggdfgfdgdfgdfgfd fgdfgdfgdfgdfgdfgdgdgdfgdfgdfgdfdfdfgdfgdfgfgdfggdgsdsdfgsdgsdfgdsssgsd</div>
<div class='right'>And this should be on the right </div>
</div>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句