Languages
[Edit]
EN

CSS - convert div to inline element

0 points
Created by:
Elmer-Li
396

In this article, we would like to show you how to convert div to an inline element using CSS.

Quick solution:

div {
  display: inline;
}

Note:

You can also use <span> instead of <div> tag which is inline by default.

 

Practical example

In this section, we present a practical example of how to convert div to an inline element using CSS.

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<head>
  <style>
    div {
      display: inline;
      border: 1px solid black;
    }
  </style>
</head>
<body>
  <div>The first div element.</div>
  <div>The second div element.</div>
  <div>The third div element.</div>
</body>
</html>

References

  1. display - CSS: Cascading Style Sheets | MDN
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join