Cats rub against your legs to show they like you, to leave their scent, and to ask for attention to pet them or play with them.