'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:
I want to write this words side by side.Thanks for your help.
Solution 1:[1]
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>
Solution 2:[2]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Aryan |
| Solution 2 | Faizal Hussain |
