Sanyam
Sanyam

Reputation: 104

Display heading and Content in Single Line

I want to display Heading and its content in a single line but it splits into two lines.

For example:

<h3> Some Heading: </h3>
<p> Some Content </p>

In this I want to display it like:

Some Heading: Some Content

If anyone can help solve this, it would be highly appreciated.

Upvotes: 0

Views: 3003

Answers (3)

Roma
Roma

Reputation: 199

Already answered by @Dogukan Cavus.

The Heading and Content can be displayed in Single line by adding display: inline-block to css style.

<h3 style="display: inline-block"> Some Heading: </h3>
<p style="display: inline-block"> Some Content </p>

Example: http://jsfiddle.net/a4aME/1/

Upvotes: 1

Yashwardhan Pauranik
Yashwardhan Pauranik

Reputation: 5566

Wrap both your tags by a div and set the divs display property to flex.

<div style="display: flex">
   <h3> Some Heading: </h3>
   <p> Some Content </p>
</div>

Upvotes: 0

doğukan
doğukan

Reputation: 27411

Add it to your css codes.

h3,p {
  display:inline-block;
}

Upvotes: 1

Related Questions