Measure distance

I am new to Arduino and need some advice. I am prototyping a simple tool to measure the distance of items on a shelf. I would like to place the device on a shelf and need to find out when the item is removed. The shelf is no more than 12inches/30cm It needs to be accurate to about ½ inch/cm
I am just looking for input on what kind of measuring device, either laser or other recommendation. It can’t be expensive, because I will have a many of these.
Thanks in advance for your input.

For cheap distance measurement you will probably want to use the ultrasonic sensor, HC-SR04 or the like. Note that when using multiple sensors they can interfere with each other so you will want to send pings and wait a reasonable time for the echo to return on each sensor in turn. That should be not problem since you're not trying to capture rapid activity. The sensors also have a fairly wide range so you will be limited in how closely you can pack the items on the shelf.

However, I don't understand why you need to precisely measure distance. You say you want to detect removal so that would only require detecting the presence/absence of an object. For that purpose you could use a modulated IR sensor, which has a narrower range. These are significantly more expensive than the ultrasonic sensors but a bit easier to work with. I would not recommend the cheaper unmodulated IR sensors as they can be interfered with by other light sources such as sunlight or a monitor.

One or more items on the shelf at the same time?
What's the nature of the items, in size/colour/transparency/material/etc?
1/2" = 1.252 cm, not 1/2 cm which is about 0.2". Which one is it?
And indeed: what do you really want to measure? Location of item on the shelf and/or it's presence? This are two different things - can to a certain extent be done with the same sensor, though.