Encapsulation is stuffing HTML, JavaScript, and Styles into a web component or element, for example, a class, and then controlling access to that component by isolating the container from the rest of the web page. A great example is using the Shadow DOM API with Web Components.