Jump to content

Recommended Posts

I have a page that currently is populating some information from a database and turning it in to links to another page

 

for this i am using a while loop with  mysql_fetch_array

 

and generating the links in this. However the output then is with the links really tightly packed one after the other, so i thought i would use some css to try and make it look better

 

How can i add css in to this as its in the php code isnt it?

 

thanks guys

Link to comment
https://forums.phpfreaks.com/topic/181022-css-and-php/
Share on other sites

Even though the code that's generating the links is written in PHP, its outputting HTML.  Simply use what you would for straight HTML with CSS - an id or class that a stylesheet can grab a hold of, or an inline style.  Example:

 

while($val = mysql_fetch_assoc($values))
{
   echo "<a href='newpg.php?id=" . $val['key'] . "' class='links'>" . $val['itsType'] . "</a><br />";
}

Link to comment
https://forums.phpfreaks.com/topic/181022-css-and-php/#findComment-955084
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.