'Selecting a class within an id

this is probably a noob question but I want to select the link via css. $page being returned is just a number being passed in and not a big deal. I want to select the class "link1". Here is the html code.

    echo '<ul id="navlist">
<li><a class:"link'.$page.'" href="index.php?page=1">Home</a></li>
<li><a class:"link'.$page.'" href="index.php?page=2">Shoes</a></li>
<li><a class:"link'.$page.'" href="index.php?page=3">Drills</a></li>
<li><a class:"link'.$page.'" href="index.php?page=4">Top Player</a></li>
<li><a class:"link'.$page.'" href="index.php?page=5">Contact Us</a></li></ul>

Thank you!



Solution 1:[1]

Well first thing that jumps out to me is that your code has "class:" instead of "class=". That's almost certainly not going to be parsed correctly.

With regard to "selecting" the link, I'm assuming you mean for a style sheet so you can add some styles to it? In that case the CSS selector would be:

#navlist .link1

Solution 2:[2]

So, if I understand what you want to do.. In your CSS you can target those links like this:

.link1 {
    color: red;
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matt Farmer
Solution 2