Jsoup select elements with multiple classes example

Jsoup select elements with multiple classes example shows how to select elements having multiple classes separated by space characters.

How to select elements with multiple classes using Jsoup?

Many times HTML elements have multiple classes applied to them using the “class” attribute as given below.

It becomes a little tricky to select such elements using CSS style selectors. If the div element had a single class named “left-align”, you could have written Jsoup CSS selector like given below.


If the element contains multiple classes, you can join them using separator “.” (dot) as given below.


Please note that there is no space between the two classes.

Here is the full example program to select div with multiple classes.


This example is a part of the Jsoup tutorial with examples.

Please let me know your views in the comments section below.

About the author



My name is RahimV and I have over 16 years of experience in designing and developing Java applications. Over the years I have worked with many fortune 500 companies as an eCommerce Architect. My goal is to provide high quality but simple to understand Java tutorials and examples for free. If you like my website, follow me on Facebook and Twitter.

Add Comment

Your email address will not be published. Required fields are marked *

Online Shopping