<!DOCTYPE html> <html> <style> div { height: 20px; } div > div { width: 100px; background: green; } body > div { direction: ltr } </style> <body style="width: 400px"> <div><div style="margin-left: 100px; margin-right: auto"></div></div> <div><div style="margin-left: auto; margin-right: 100px"></div></div> <div><div style="margin-left: auto; margin-right: auto"></div></div> <div><div style="margin-left: 200px; margin-right: auto"></div></div> <div><div style="margin-left: 100px; margin-right: 100px"></div></div> </body> </html>