Home > front end >  HTML Write side by side
HTML Write side by side

Time:05-15

I want to type words side by side.When I type words, they come one after the other.

Here's my problem:

problem

I want to write this words side by side.Thanks for your help.

CodePudding user response:

This can be done by setting the display mode to inline-block.

.myclass {
  display: inline-block;
}

CodePudding user response:

There are two methods to achieve this.

First:

Use inline-block on children

<div>
  <p  >privacy</p>
  <p  >policy</p>
</div>
<style>
 .card {display: inline-block;}
</style>

Second:

Use flex on parent element

<div >
  <p>privacy</p>
  <p>policy</p>
</div>
<style>
  .container {
     display: flex;
  }
</style>

CodePudding user response:

By default the HTML elements are in display: block , they appear one after another, this applies to all the elements you can change this by changing the display property of the parent like

   .dflex{
    display:flex
    }

    <div >
    <div>A</div>
    <div>B</div>
    </div>

here all those children inside the parent will appear one after another

  •  Tags:  
  • html
  • Related