0
我有一个带有文本的div,我想将某些文本移动到div的右侧,而无需创建和处理表格。下面是我有和它的作品无济于事:将部分文本移动到div的右侧
<div style="height:50px;background-color:#06276F;color:#FFF;padding:5px;">
<img align="left" height="50px" width="50px" style="margin-right: 10px;"
src="<?php echo PilotData::getPilotAvatar($pilotid);?>" />
<strong>Name: </strong> <?php echo Auth::$userinfo->firstname . ' ' . Auth::$userinfo->lastname;?>
<span style="text-align:right;"><strong>Total Flights: </strong><?php echo Auth::$userinfo->totalflights?></span><br />
<strong>Pilot ID: </strong> <?php echo $pilotid ; ?>
<span style="text-align:right;"><strong>Total Hours: </strong><?php echo Auth::$userinfo->totalhours;?></span><br />
<strong>Rank: </strong><?php echo Auth::$userinfo->rank;?>
<span style="text-align:right;"><strong>Hub: </strong><?php echo Auth::$userinfo->hub;?></span><br />
</div>
这里是什么样子:
您可以使用float :right – 2013-08-16 21:41:52
想法:1)将图像作为div的背景,并有一个paddin g的div的图像宽度。 2)在图像中使用float并将文本包裹在另一个浮动div中。 – mshsayem
@ marcelo2605不错。不知道你可以用文字做到这一点。 –