Use CSS media queries and flexible layouts to ensure headers and footers adapt to different screen sizes and devices.