<!DOCTYPE html> <html> <head> <style> .parent{ width:400px; height:200px; background-color:lightblue; position:relative; font-size:15px; } .div1{ width:30%; height:40%; background-color:red; position:absolute; left:2.5%; top:30%; } .div2{ width:30%; height:40%; background-color:lightgreen; position:absolute; left:35%; top:30%; } .div3{ width:30%; height:40%; background-color:yellow; position:absolute; right:2.5%; top:30%; } </style> </head> <body> <div class="parent"> <div class="div1"></div> <div class="div2"></div> <div class="div3"></div> </div> </body> </html>
Run
×
Share