I'm trying to style the pager of a WebGrid
element in Asp.Net MVC. The pager looks something like this:
<td colspan="4">
<a href="#"><<</a>
<a href="#">1</a>
2
<a href="#">3</a>
<a href="#">>></a>
</td>
Although I can easily style the a
elements, I'm having problems styling the "untagged" text (in this example, the 2
). Is there a way I could target/select just the text and not the anchor elements? (JSFiddle provided)
I am not aware of any CSS selector that can target text nodes. You can use JavaScript or jQuery to wrap the active link inside a tag; then style it appropriately. Here is an example:
$(".pagination").contents().filter(function () {
return this.nodeType === Node.TEXT_NODE && /\d+/.test(this.nodeValue);
}).wrap("<b></b>");