Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

How to display paragraph elements as inline using CSS ?

  • Last Updated : 05 Nov, 2020

The purpose of this article is to display paragraph elements as inline elements using CSS. The display property in CSS is used for placing the components (“div”, “hyperlink”, “heading”, etc) on the web page. The display property is set to inline. It has the default property of “anchor” tags. It is used to place the “div” inline i.e. in a horizontal manner. The inline option of display property ignores the “width” and “height” set by the user.


Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

display: inline; 



<!DOCTYPE html>
        #main {
            height: 200px;
            width: 200px;
            background: teal;
            display: inline;
        #main1 {
            height: 200px;
            width: 200px;
            background: cyan;
            display: inline;
        #main2 {
            height: 200px;
            width: 200px;
            background: green;
            display: inline;
        .gfg {
            margin-left: 20px;
            font-size: 42px;
            font-weight: bold;
            color: #009900;
        .geeks {
            font-size: 25px;
            margin-left: 30px;
        .main {
            margin: 50px;
    <div class="gfg">GeeksforGeeks</div>
        How to display paragraph elements 
        as inline elements using CSS?
    <p class="main">
    <p id="main"> BLOCK 1 </p>
    <p id="main1"> BLOCK 2</p>
    <p id="main2">BLOCK 3 </p>


Supported browsers are listed below:

  • Google ChromeInternet Explorer
  • Firefox
  • Opera
  • Safari

My Personal Notes arrow_drop_up
Recommended Articles
Page :