title: Html Agility Pack get all elements by class
body: <p>I am taking a stab at html agility pack and having trouble finding the right way to go about this.</p>
  
  <p>For example:</p>
  
  <pre><code>var findclasses = _doc.DocumentNode.Descendants("div").Where(d =&gt; d.Attributes.Contains("class"));
  </code></pre>
  
  <p>However, obviously you can add classes to a lot more then divs so I tried this..</p>
  
  <pre><code>var allLinksWithDivAndClass = _doc.DocumentNode.SelectNodes("//*[@class=\"float\"]");
  </code></pre>
  
  <p>But that doesn't handle the cases where you add multiple classes and "float" is just one of them like this..</p>
  
  <pre><code>class="className float anotherclassName"
  </code></pre>
  
  <p>Is there a way to handle all of this?  I basically want to select all nodes that have a class = and contains float.</p>
  
  <p>**Answer has been documented on my blog with a full explanation at: <a href="http://www.adamthings.com/post/2013/10/14/html-agility-pack-get-elements-class/">Html Agility Pack Get All Elements by Class</a></p>