<!DOCTYPE html> <html> <head> <style> .parent{ width:400px; height:400px; background-color:lightblue; margin:auto; } .div1{ width:40%; height:40%; background-color:red; float:left; margin:30% 5%; } .div2{ width:40%; height:40%; background-color:lightgreen; float:left; margin:30% 5%; } </style> </head> <body> <div class="parent"> <div class="div1"></div> <div class="div2"></div> </div> </body> </html>
Run
×
Share