Open In App
Related Articles

How to display paragraph elements as inline using CSS ?

Improve Article
Save Article
Like Article

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.


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

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 05 Nov, 2020
Like Article
Save Article
Similar Reads
Complete Tutorials