rabidmachine9
rabidmachine9

Reputation: 7965

different css class on the same echo?

here is the problem...I have just this line of code:

<p><div class="author"><?php echo $relevantEntry['author']." | ".date("D d M Y h:i:s A", strtotime($relevantEntry['date_time'])); ?></div></p>

and I want to apply a different css css to author and date...but I still want them to be in the same line and be presented as the same statement...

any ideas how can I do that? thanks

Upvotes: 0

Views: 450

Answers (3)

Joseph
Joseph

Reputation: 1963

Use <span></span> to surround the portions of the line you want formatted a specific way.

<p>
    <div class="author">
        <span class="classOne"><?php echo $relevantEntry['author']."</span> | 
        <span class=\"classTwo\"".date("D d M Y h:i:s A", strtotime($relevantEntry['date_time'])); ?></span>
    </div>
</p>

The advantage of the <span> tag is that there is no inherent formatting involved that you will need to work around.

Upvotes: 0

GOsha
GOsha

Reputation: 689

<p><div class="author"><?php echo $relevantEntry['author']; ?> | <span class='date'> <?php echo date("D d M Y h:i:s A", strtotime($relevantEntry['date_time'])); ?></span></div></p>

Upvotes: 1

Bella
Bella

Reputation: 3217

Wrap the date in a:

<span class="dateclass"></span>

Like this

<p>
<div class="author">

<?php echo $relevantEntry['author']; ?>

<span class="date">
<?php echo date("D d M Y h:i:s A", strtotime($relevantEntry['date_time']));?>
</span>

</div>
</p>

Upvotes: 1

Related Questions