How would you style a PHP suffix with CSS?

718 views Asked by At

I've setup a date object in PHP: $date_formatting = "l, M jS";

Note the uppercase S to the right of the day (j). This creates a suffix such as 3rd, 1st, 2nd.

The problem is I don't know how to go about targeting only the suffix for CSS styling. I would like to make the suffix a smaller font size than the number.

Any clues?

3

There are 3 answers

2
Brad On BEST ANSWER

$date_formatting="l, M j<\s\u\p>S<\/\s\u\p>";

What this does is puts the <sup> tag around the S. This tag is for superscript.

0
Jonah On
$date_formatting = "l, M, j<\s\m\a\l\l>S</\s\m\a\l\l>";
3
nico On

Or, if you want to avoid the pain of escaping all of that...

echo date("l, M j")."<span class='whatever'>".date("s")."</span>";