How could i make sure my <p class="title"></p>
and
<p class="subtitle"></p>
are displayed underneath of eachother because right now they are being displayed next to eachother
Asked
Active
Viewed 111 times
-2

Noah Bergh
- 493
- 4
- 14
-
Do you already have some CSS? Could you please share it here? If you write two `p` tags the second already goes in new line. – Balastrong Sep 16 '21 at 18:13
1 Answers
0
You can make use of flexbox
, it'll definitely solve your problem.
Example
If you want to arrange two items underlying with each other:
.container {
display: flex;
flex-direction: column;
}
<div class="container">
<p class="title">Hello</p>
<p class="subtitle">World</p>
</div>
If you want to arrange two items next to each other.
.container {
display: flex; /*by default it will align items in one row*/
}
<div class="container">
<p class="title">Hello</p>
<p class="subtitle">World</p>
</div>
-
1Yes , correct way but mistake is in his CSS code because `
` tag is a block-level element , so always start from new line
– Rana Sep 16 '21 at 18:30 -