How to align two divs horizontally in HTML?

To align two divs horizontally in HTML, use the float CSS property with left value. You can try to run the following code to learn how to align divs horizontally −


Live Demo

<!DOCTYPE html>
.demo div {
    float: left;
    clear: none;
<div class="demo">
        <select size="5">
           <option value="c1">India</option>
           <option value="c2">US</option>
           <option value="c3">UK</option>
           <option value="c4">Australia</option>
        <select size="5">
           <option value="r1">1</option>
           <option value="r2">2</option>
           <option value="r3">3</option>
           <option value="r4">4</option>