Areeba Shinwari
Areeba Shinwari

Reputation: 13

Add style in php variable

I have used the simple php pagination, but now i have to add some style on my pagination. but i dont know how to add the css style in php variable. Here is my code:

   for($number=1;$number<=$messageCount;$number++)
                        {
                            echo '<a href="?page=' .$number. '">' .$number. ' &nbsp;</a>'; 

                        }
                        //echo "<br> Current Page: $page";

I want to add the style to $number variable.

Upvotes: 1

Views: 4591

Answers (1)

WPZA
WPZA

Reputation: 921

Please tell us what you've tried so far? From what I gather you're asking for a style to be added to your $number?

PHP

echo '<a href="?page=' .$number. '"><span class="cssClassName">' .$number. '</span></a>';

CSS

<style>
    span.cssClassName {
         /* Add your styling here */
         margin: 0 10px 0 0; /* Gets rid of the use of &nbsp; to space them out */
    }
</style>

Upvotes: 1

Related Questions