4

I have this html code

<h2>
  <div style="display:flex">
  <div>
    Section III :
  </div>
  <div>
    Very long parangrapgggggggggggggggggggggggggggggggggggggggggggggggggggggggg
  </div>
  </div>
</h2>

The space inside the first div makes a new line, Can any body suggest how to attain this format ? I dont to have anything below the Section III, I dont want to use tho and I dont want to adjust width padding etc, is there a way to achieve this ?

Leroy
  • 168
  • 10

3 Answers3

7

Looks like the text breaks into multiple lines, which makes it look odd. I added the white-space: nowrap styling. You may also want to add some spacing between the two divs.

<h2>
  <div style="display:flex; white-space: nowrap;">
    <div>
      Section III :
    </div>
    <div>
      Very long parangrapgggggggggggggggggggggggggggggggggggggggggggggggggggggggg
    </div>
  </div>
</h2>
Celsiuss
  • 852
  • 8
  • 18
1

try white-space:nowrap css from the div tag

Nethra
  • 519
  • 2
  • 8
0

You have to apply display:flex to outer div and display: inline-block to inner divs

.myClass {
  display: inline-block;
  background-color: green;
}

.outerDiv {
  display: flex;
}
<h2>
  <div class="outerDiv">
    <div class="myClass">
      Section III :
    </div>
    <div class="myClass">
      Very long parangrapgggggggggggg
    </div>
  </div>
</h2>
Himanshu Singh
  • 2,083
  • 1
  • 4
  • 14