rANth rANth - 4 months ago 8x
HTML Question

display 2 <p>'s side by side

I want to display 2 paragraphs side by side.

<p class = "firstClass">This is first line.</p>
<p class = "secondClass">This is second line.</p>


This is first line.
This is second line.

Desired output:

This is first line.This is second line.

To achieve desired output, what should I be writing in css file for classes 'firstClass', 'secondClass'?

Answer: I tried "display:inline" for both of classes and then it didn work

.firstClass, .secondClass {display: inline;}

If other CSS is overriding this display setting, increase selector specificity by using:

#parent_id .firstClass, #parent_id .secondClass {display: inline;}

If that does not help, you can use this AWFUL trick (as a last resort):

.firstClass, .secondClass {display: inline!important;}