Distinguish them to human viewers, not to computers. If the aggregate effect of all the CSS and element classes is to make ads look one way and non-ads look a different way (each with slight variations), it's an AI-complete problem infer an answer to "given these elements and this CSS sheet, which subset of them looks different and add-like to a human?"
Is it an AI-complete problem to do email spam classification? Why is determining if a facebook post is an ad or not so different than spam classification?
It's AI complete to do it with human level accuracy, yes. If you don't mind blocking random friends' posts, you can craft the ad blocker to remove them all.