Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    Regular Coder
    Join Date
    Nov 2008
    Posts
    175
    Thanks
    4
    Thanked 6 Times in 6 Posts

    Using a class in a link

    I know this should probably be better off in the PHP forum but it's also a css question so I'm posting it here.

    Basically I have,

    Code:
    a:link, a:visited {
    color: #fff; text-decoration:none;
    }
    a:hover, a:active {
    color: #FFFFCC ; text-decoration:underline;
    }
    To make all my links go white, but I want this one link to be black, but it is in a PHP code and what I do for it isn't working.

    This is what I've got.

    Code:
    $content .= '<a class="pageNumber" href="buying.php?pg=' . $i . '">' . $i . '</a>' . "&nbsp; ";
          } else {
             $content .= '<a class="pageNumber" href="buying.php?pg=' . $i . '">' . $i . '</a>' .  "&nbsp; ";
    Code:
    .pageNumber a:link  {
    color: #000;
    }

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    .pageNumber a:link {
    color: #000;
    }
    That should be
    Code:
    a.pageNumber:link{
    color: #000;
    }
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder
    Join Date
    Nov 2008
    Posts
    175
    Thanks
    4
    Thanked 6 Times in 6 Posts
    Didn't fix it, can you see anything else wrong with it? Here's the code from the source code of one of the links

    Code:
    <div id="result-data"><br><small style='font-size:11px;'>Found 6 listings</small><br><br><small style='font-size:11px;'>Pages: <a class="pageNumber" href="buying.php?pg=1">1</a>
    And a link to the actual page, http://www.sampleestateagent.com/buying.php but if you want to see the links you have to click either 3, 6, 9 or 12 properties per page and then it's the page numbers that come up white that I want black

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    but if you want to see the links you have to click either 3, 6, 9 or 12 properties per page and then it's the page numbers that come up white that I want black
    Can't you post a direct link? Or you may save your page as html from browser and upload it to a new location along with the linked stylesheet. (Sorry, I don't get that highlighted part)
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #5
    Regular Coder
    Join Date
    Nov 2008
    Posts
    175
    Thanks
    4
    Thanked 6 Times in 6 Posts
    Hmm, you can't because the only link is the one i gave as it saves your search in your browser only,

    what I mean is, if you go on the link and at the bottom, it says Number of Properties Per Page and for you to see the page numbers come up, you have to click one of the other options other than all (otherwise all the properties come up on one page)

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Pages: 1 2 3 4 5 6
    That part is in black for in FF2, accepting the style
    Code:
    a.pageNumber:link {/*stylenew.css (line 32)*/
    color:#000000;
    }
    very well. Do a hard refresh (Ctrl+F5)/ clear the browser cache and check again.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #7
    Regular Coder
    Join Date
    Nov 2008
    Posts
    175
    Thanks
    4
    Thanked 6 Times in 6 Posts
    I was clearing the cache thinking why isn't it working and it's because once you've clicked the link it makes it go white again which is the a:visited function.

    How can I use visited in your code to make it stay the same colour?

    Code:
    a.pageNumber:link{
    color: #000;
    }

  • #8
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Code:
    a.pageNumber:link , a.pageNumber:visited{
    color: #000;
    }
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #9
    Regular Coder
    Join Date
    Nov 2008
    Posts
    175
    Thanks
    4
    Thanked 6 Times in 6 Posts
    What would be the best way to make my selected page be bold or a different colour?

    I came up with this from google http://www.search-this.com/2007/06/1...age-indicator/ but the problem is that my links arn't usual links as they come from PHP.

    I also thought this would work but doesn't, although it might be the way I wrote it.

    Code:
    a.pageNumber:hover, a.pageNumber:active {
    color: #FFFFCC;
    text-decoration:underline;
    }
    Is there any idea of how to highligt a link with CSS with this code
    Code:
    $content .= "<br><small style='font-size:11px;'> ";
    		for($i = 1; $i <= $pages; $i++) {
    			if($i == 1 && $i == $pages) {
    				$content .= $i;
    			}elseif($i == $pages) {
    				$content .= '<a class="pageNumber" href="buying.php?pg=' . $i . '">' . $i . '</a>' . "&nbsp; ";
    			} else {
    				$content .= '<a class="pageNumber" href="buying.php?pg=' . $i . '">' . $i . '</a>' . "&nbsp; ";
    			}
    		}
    		$content .= "</small><br>";

  • #10
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    What would be the best way to make my selected page be bold or a different colour?
    I prefer the method given at http://www.codingforums.com/showpost...64&postcount=3
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #11
    Regular Coder
    Join Date
    Nov 2008
    Posts
    175
    Thanks
    4
    Thanked 6 Times in 6 Posts
    Buy my pages don't have links like

    Code:
    <ul id="nav">
    	<li id="nav_home"><a href="#">home</a></li>
    	<li id="nav_about"><a href="#">about</a></li>
    	<li id="nav_contact"><a href="#">contact</a></li>
    </ul>
    It's done in PHP so you don't see every individual link like that.

  • #12
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    You could device a logic to dynamically apply different class/id to those links.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #13
    Regular Coder
    Join Date
    Nov 2008
    Posts
    175
    Thanks
    4
    Thanked 6 Times in 6 Posts
    Any chance you giving me a clue on how to start the logic?

  • #14
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Ah.. wait. They are links from a pagination system, right? So, why do you need to display the selected items as a link? Just echo that number when the selection is on that page, otherwise show the link.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •