I am working on an image cropper. And I am on the first stages. I want to know how to create the the two divs over the image, one is transperent while the other acts as a mask.

Can this be done with CSS? Or should I consider jQuery?

This is what I want to accomplish ...

Croppr_js.png

I just want to know how to create this overlay image feature.

How do you make the whole image with black transperent and the selected part has no opacity?

There's no way to do this only with HTML & CSS. You'll need to throw some JS into the mix. There are loads of plugins (jQuery or pure JS) that you can find with a Google search.
Here's for example one made with pure JS. It's a modern one which is therefore also responsive and it has touch support.
https://jcrop.com/examples/

commented: "Can touch this!" That's an upgrade. +15

I have another question ...
How do they make part of the image transparent while the rest is darkened?
Are they using HTML5 Canvas? I want to accomplish this effect.

If you look with the developer tools of your browser you can see in that jcrop example how it's made of. The dark area are a bunch of divs added dynamically with JS and it calculates the width and hight distances of the crop area. Anyway there's probably a lot going on behind the scenes to get the desired effect, so my question is why do you want to make this image cropper yourself?

I want to learn how to do things myself using jQuery. I am doing it just to learn nothing more.

Ah ok, good for you! If you wanna learn then look at the many cropper plugins out there via the browsers' DevTools to see how they did it. You can also use JS debugger in DevTools to see which functions or lines of JS gets triggered by all the events (click, mouseenter, etc.). In Chrome DevTools it's the 'Sources' tab.