Hello is there a simple way to align text inside span? I found several solutions but nothing seems to work for me. Here is my code:
<?php echo Yii::t('default','Tax Amount').': ';?>
<span style="border-bottom: 1px solid; ">
<?php echo Yii::app()->locale->numberFormatter->formatCurrency($taxamount, 'EUR');?>
</span>
</span>
All I want is to align the $taxamount
to the right and leave Tax Amount to the left as is. I thought it was pretty easy at first but nothing works! I also tried it with div and it worked but it messes with anything I have below that. I have three more echo’s like this below that code. I'm not very proficient with CSS and I would appreciate any help.
My full code is something like this:
<?php echo Yii::t('default','Amount').': ';?>
<span style="border-bottom: 1px solid;">
<?php echo Yii::app()->locale->numberFormatter->formatCurrency($model->credit, 'EUR');?>
</span>
<br>
<?php echo Yii::t('default','Tax').': 23%';?>
<br>
<?php echo Yii::t('default','Tax Amount').': ';?>
<span style="border-bottom: 1px solid; ">
<?php echo Yii::app()->locale->numberFormatter->formatCurrency($taxamount, 'EUR');?>
</span>
</span>
<br>
<?php echo Yii::t('default','Total').': ';?>
<span style="border-bottom: 1px solid;">
<?php echo Yii::app()->locale->numberFormatter->formatCurrency($total, 'EUR');?>
</span>
I comment out everything and I only used one solution as suggested below. So my code now is like this:
p>span {
display: inline-block;
width: 50%;
}
p>span:last-child {
text-align: right;
}
.pull-left {
float: left;
}
.pull-right {
float: right;
}
<p><span>Tax Amount</span><span>EUR 12.50</span></p>
I use mpdf extension in Yii to print the results in pdf. So this is all my code now plus the mpdf extension.But still nothing happens!