- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to place two divs next to each other in HTML?
With CSS properties, you can easily put two <div> next to each other 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 two <div> side by side −
<!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> </body> </html>
- Related Articles
- How to align two divs horizontally in HTML?
- How can I put two buttons next to each other in Tkinter?
- How to create wrapper div around two other divs with jQuery?
- How many images will be formed if we place two plane mirrors in front of each other?
- Can two acute angles be complement to each other?
- How to wrap multiple divs in one with jQuery?
- How to check if two Strings are anagrams of each other using C#?
- Two astronauts are floating close to each other in space. Can they talk to each other without using any special device? Give reasons.
- Place K-knights such that they do not attack each other in C++
- Prove that two lines are respectively perpendicular to two parallel lines , they are parallel to each other.
- C# program to determine if Two Words Are Anagrams of Each Other
- In addition to carbon dioxide and water, state two other conditions necessary for the process of photosynthesis to take place.
- Can two line segments intersect each other at two points?
- In each of the two lines is perpendicular to the same line, what kind of lines are they to each other?
- How to place text over an image with HTML and CSS?

Advertisements