将文字放在图像旁边

时间:2016-06-01 09:35:21

标签: php html css

为什么我的文字不在我的图片旁边?我已经尝试将所有这些都放在1 div中,但这也不起作用。

<div class="modal fade" id="mijnModel<?=$row['ID'];?>" role="dialog">
<div class="modal-dialog modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal">&times;</button>
            <h4 class="modal-title"><?php echo $row ['product_naam'] ?></h4>
        </div>

        <div class="modal-body" style="height: auto;">
            <img src="/product_images/<?php echo $row ['product_afbeelding'] ?>" style="width:250px; height:250px;">
            <h2 style="margin-left: 350px; float: right;">Prijs: <?php echo "<td>" . "€" . $row['product_prijs'] . "</td>"; ?></h2>
            <br>
            <p style="margin-left: 350px;float: right; margin-top: -50px;"><strong>Omschrijving:</strong>
                <?php echo "<td>" . $row[ 'product_omschrijving'] . "</td>"; ?>
            </p>
            <br>
            <p><strong>Specificaties:</strong>
                <?php echo "<td>" . $row[ 'product_specs'] . "</td>"; ?>
            </p>
            <br>
        </div>
        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        </div>
    </div>

</div>

enter image description here

2 个答案:

答案 0 :(得分:1)

浮动图像内容吧。没有使用bootstrap并使用容器行和列。这将使它更清洁。

答案 1 :(得分:0)

使用绝对位置和左边距:350px;

<h2 style="margin-left: 350px;position: absolute;">Prijs: <?php echo "<td>" . "€" . $row['product_prijs'] . "</td>"; ?></h2>