I've used the ruler in the past, but I personally prefer using the Rectangular Marquee Tool (M) available just under the Move Tool on your menu.
Now just use the tool to select a box that'll show the dimensions.
a) Sometimes you can be 1 or 2px off, it can be difficult to be pixel-precise (if this is the case, however, zooming in is a quick fix).
b) Pixel values only appear while actively holding down the tool. This has never been a problem for me.
(Screenshots from Mac OSX version of Adobe Photoshop CS6)
This is one feature that is superior in Adobe Photoshop CC--when you have the "Extra" guides on (Ctrl+H), you can hold down CTRL and it will display spacing information between the layer you have selected and other, nearby layers.
Ensure that Smart Guides are turned on. In View, go to Show (under 'Extra') and enable Smart Guides.
Smart Guides does work in Photoshop CS6, however it doesn't show measurements to nearby layers (as far as I know). I highly recommend using it if you're doing web design tasks.
(Screenshot from Windows 8 version of Adobe Photoshop CC)
Do your rulers not use pixels?
Go to Preferences > Units & Rulers and set "Rules" to "Pixels." As a personal preference, I keep type set to Points (though I don't believe there's a difference if you're editing at 72 pixel resolution).