How we can put three divisions <div> side by side in HTML?

HTMLWeb DevelopmentFront End Technology

With CSS properties, you can easily put three <div> side by side in HTML. Use the CSS property float to achieve this.

With that, add height:100px and set margin.

Example

You can try to run the following code to place three <div> side by side.

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <title>HTML div</title>
   </head>
   <body>
      <div style="width: 100px; float:left; height:100px; background:gray; margin:10px">
         First DIV
      </div>
      <div style="width: 100px; float:left; height:100px; background:yellow; margin:10px">
         Second DIV
      </div>
      <div style="width: 100px; float:left; height:100px; background:red; margin:10px">
         Third DIV
      </div>
    </body>
</html>
raja
Published on 01-Feb-2018 08:44:51
Advertisements