How do I attach shelves to a wall?

I have several shelves I want to hang that have key hole backs. Every time I’ve tried to hang them, the shelf doesn’t sit flush to the wall. How do I attach them and not have them fall forward?
q how do i attach shelves to wall

How do I attach this type of key hole shelving

I once saw a site showing how to attach this type of shelf FLUSH to the wall. When I hang them, the back edge falls forward and does not touch the wall. Looks horrible.
q how do i attach this type of key hole shelving

Paint or no paint??

i painted the doors and facings upstairs. How much of the facings to I paint? I can't decide
q paint or no paint

How to tile if the base isn't level.

I am putting glass tiles around the garden tub in the master bath. When I checked if the surround that the tile will rest on was level I found that there is at least 1/4 inch difference from one side of the front and back of the tub to the other side. Any suggestions on tile placement. I can't imagine it looking right with small triangular pieces of tile along the bottom. The length side of the tub is level. could it be the house itself leans and the surround is level? How do I know?thanks

Framing a large bathroom mirror

i.Need some ideas on framing a bathroom mmirror