How does online credit card payment and the whole online payment system work?

1)How does the whole system and procedure work?
2)Do debit cards work as well as credit cards?
3) I know the consumer has to take precautions but what are the security procedures and precautions taken by credit card companies and online payment companies and systems to protect you?
4) What shud i look for in a website to [...]