$story1 = ("<br /><br />But <u><b><span class='hint--top' data-hint='soft'>$noun1</span>
I'm trying to make a span around one word with a linked css style sheet. The class does not want to work. What am I doing wrong?
Give this code a try if that is the expected results you are looking to get.
The following will output "But This is a noun" having This is a noun
underlined and in light gray color.
<?php
$noun1 = "This is a noun";
$story1 = "<br /><br />But <u><b><span class='hint--top' data-hint='soft'>$noun1</span>";
echo $story1;
?>
<style>
.hint--top {
color:#cccccc;
}
</style>
NOTE: I suggest you close your <u>
and <b>
tags, otherwise the rest of your HTML will show up as underlined and bold.
Change this line in "my" code:
$story1 = "<br /><br />But <u><b><span class='hint--top' data-hint='soft'>$noun1</span>";
to:
$story1 = "<br /><br />But <u><b><span class='hint--top' data-hint='soft'>$noun1</span></b></u>";
if that is the case. I don't know if your code is dynamically-generated.
There's a syntax error on your code. You need to close the quotes properly. [Modified Code Below]
$story1 = "<br /><br />But <u><b><span class='hint--top' data-hint='soft'>".$noun1."</span>";