yes you can use the attribute selector sth. like:
a[href="http://usefullink1"] {}
you could also use:
a[href~="usefullink"] {}
to match all containing the word “usefullink” in href
yes you can use the attribute selector sth. like:
a[href="http://usefullink1"] {}
you could also use:
a[href~="usefullink"] {}
to match all containing the word “usefullink” in href
Use the :nth-child
pseudoclass.
Like so : .main p:nth-child(3) a
I used attribute selector with a not clause.
.main p a:not([href*="text_in_all_useless_links_but_not_in_usefull_ones"])
My html code is as below..
<html>
<body>
<div class="main">
<div class="sub1">
<p><a href="http://uselesslink1"></a></p>
<p><a href="http://uselesslink2"></a></p>
</div>
<div class="sub2">
</div>
<p><a href="http://usefullink1"></a>
<a href="http://usefullink2"></a>
</p>
</div>
</body>
</html>
I need to access the useful links http://usefullink1 and http://usefullink2 using css selectors and use
.main p a
But doing this I’m able to access both useful links and also the useless links which are inside the div sub1 inside div main.
With the above html structure is it possible to access only the usefull links and not the useless ones using css.
All help is sincerely appreciated.
Thanks
Thanks for the answer but usefulllink is just a word I used to explain what I need, its going to keep changing in different pages with different urls. I will check to see if there is a common text amongst the useful links which does not exist in the useless links
looking at your code you could also try
Or
@retterBadach really good one, actually better than your provided answer. Though I used attribute selector with a not clause as I got it early.
@Arnab. You must have found some common text which is at least helpful in your example.