On-page optimization refers to optimizing elements of a webpage that are controlled through coding, like metadata and text. Off-page optimization involves external factors not controlled by coding, such as directory submissions, article submissions, and blog comments. Common SEO techniques include white hat SEO, which follows best practices, gray hat SEO, which uses some questionable tactics, and black hat SEO, which uses manipulative or deceptive practices.