Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stylesheets with php

Status
Not open for further replies.

7724

Programmer
Feb 25, 2005
28
GB
Hi,

I'm outputting some php code and I want a style attached to what is outputted, so I have this:

Code:
print '<a href="'.$link.'class=\"small_yellow_text\">'.$headline.'</a><br /><a class=\"small_grey_text\>'.$opening.'</a><br /><br />';

Which I thought would have made my $headline yellow from my stylesheet and $opening (text) grey? But it just stays as default? Can anyone see where I have gone wrong.

Also if I wanted to make a more link below the $opening (text) with a link to the story and a yellow colour from my stylesheet, how would I do that?

Thanks

Chris
 
I do not fully understand your second question. As for the first, inspect your output code and you will see why it does not work. There are many little errors in it. Also, you're using link (<a>) element to surround text that is not a link (nor anchor). That is not good coding practice. Try:
Code:
print '<a href="' . $link . '" class="small_yellow_text">'  . $headline . '</a><p class="small_grey_text">' . $opening . '</p><a href="' . $link . '" class="small_yellow_text">more</a>';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top