suprafuedel12
suprafuedel12

Reputation: 1

HTML Write side by side

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.

Upvotes: 0

Views: 41

Answers (2)

Aryan
Aryan

Reputation: 105

There are two methods to achieve this.

First:

Use inline-block on children

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

Second:

Use flex on parent element

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

Upvotes: 2

Faizal Hussain
Faizal Hussain

Reputation: 1581

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 class="dflex">
    <div>A</div>
    <div>B</div>
    </div>

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

Upvotes: 0

Related Questions