Why is this text pushing the div onto a new line?

Exoon

I have 3 side by side divs but when i put too much text inside the div it pushes it down onto the new line.

.consoleRed {
  background: #d83435;
  border-radius: 5px;
  border: 1px #000 solid;
  color: #fff;
  margin: 5px;
}

.consoleIcon {
  float: left;
}

.consoleDesc {
  float: left;
  vertical-align: top;
}

.consoleDesc h3 {
  margin: 1px;
  padding: 1px;
  font-size: 14px;
}
<div class="container">
  <h2>Select a Console</h2>
  <div class="col-lg-4 consoleRed">
    <div class="consoleIcon"><img width="64" height="64" src="images/3ds.png"></div>
    <div class="consoleDesc">Little Text is fine</div>
    <div class="clearfix"></div>
  </div>
  <div class="col-lg-4 consoleRed">
    <div class="consoleIcon"><img width="64" height="64" src="images/3ds.png"></div>
    <div class="consoleDesc">When i add too much text it ends up pushing the whole div onto the new line</div>
    <div class="clearfix"></div>
  </div>
  <div class="col-lg-4 consoleRed">
    <div class="consoleIcon"><img width="64" height="64" src="images/3ds.png"></div>
    <div class="consoleDesc">Not sure why</div>
    <div class="clearfix"></div>
  </div>
</div>

https://jsfiddle.net/ud7xbnd7/3/

Louis 'LYRO' Dupont

What you could do is use flexbox. This is perfect to handle side-by-side disposition in CSS.

You can try the following code :

.consoleRed {
  background: #d83435;
  border-radius: 5px;
  border: 1px #000 solid;
  color: #fff;
  margin: 5px;
  display : flex;
}

.consoleDesc {
  float: left;
  vertical-align: top;
}

.consoleDesc h3 {
  margin: 1px;
  padding: 1px;
  font-size: 14px;
}
<div class="container">
  <h2>Select a Console</h2>
  <div class="col-lg-4 consoleRed">
    <div class="consoleIcon"><img width="64" height="64" src="images/3ds.png"></div>
    <div class="consoleDesc">Little Text is fine</div>
    <div class="clearfix"></div>
  </div>
  <div class="col-lg-4 consoleRed">
    <div class="consoleIcon"><img width="64" height="64" src="images/3ds.png"></div>
    <div class="consoleDesc">When i add too much text it ends up pushing the whole div onto the new line When i add too much text it ends up pushing the whole div onto the new line When i add too much text it ends up pushing the whole div onto the new line When i add too much text it ends up pushing the whole div onto the new line</div>
    <div class="clearfix"></div>
  </div>
  <div class="col-lg-4 consoleRed">
    <div class="consoleIcon"><img width="64" height="64" src="images/3ds.png"></div>
    <div class="consoleDesc">Not sure why</div>
    <div class="clearfix"></div>
  </div>
</div>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Stop <p> tags from wrapping onto a new line

From Dev

Text coming through onto overlapping div?

From Dev

Place div in new line

From Dev

Move div to new line

From Dev

New line in text inside div

From Dev

Why is Bootstrap pushing last column on next line

From Dev

<br> not breaking onto new line, view source also displaying <br>

From Dev

Pushing divs to a new line on mobile view

From Dev

display inline-block. How to prevent pushing the block to the new line?

From Dev

Why does display: flex push the following element onto a new line?

From Dev

Stop ReSharper from putting JavaScript function parameter onto new line

From Dev

Why is my text wrapping onto a second line?

From Dev

Why does Ember complain when pushing an object onto an Ember array?

From Dev

Text coming through onto overlapping div?

From Dev

Align pieces of text onto the same line

From Dev

Pushing a DialogViewController onto a ViewController onto NavigationController stack gives 2 pages

From Dev

Pushing divs to a new line on mobile view

From Dev

Why does single line text have new line?

From Dev

Why I cannot restore system image onto new hard drive?

From Dev

Why is the text pushing down the picture?

From Dev

Make the panels go onto the new line when the resolution changes

From Dev

pushing the new view controller (programatically) doesnt work ? why?

From Dev

Why is the text in an email sent via php being put on a new line?

From Dev

Why is one child div pushing pushing another child down below it?

From Dev

add text to div. New line

From Dev

Card not pushing onto to the Navigation stack, why not? Is there a limit?

From Dev

For every new text line separate, put that line into a div tag

From Dev

Why is inline-block pushing my div down:

From Dev

The paragraph is going onto a new line after the link in HTML

Related Related

  1. 1

    Stop <p> tags from wrapping onto a new line

  2. 2

    Text coming through onto overlapping div?

  3. 3

    Place div in new line

  4. 4

    Move div to new line

  5. 5

    New line in text inside div

  6. 6

    Why is Bootstrap pushing last column on next line

  7. 7

    <br> not breaking onto new line, view source also displaying <br>

  8. 8

    Pushing divs to a new line on mobile view

  9. 9

    display inline-block. How to prevent pushing the block to the new line?

  10. 10

    Why does display: flex push the following element onto a new line?

  11. 11

    Stop ReSharper from putting JavaScript function parameter onto new line

  12. 12

    Why is my text wrapping onto a second line?

  13. 13

    Why does Ember complain when pushing an object onto an Ember array?

  14. 14

    Text coming through onto overlapping div?

  15. 15

    Align pieces of text onto the same line

  16. 16

    Pushing a DialogViewController onto a ViewController onto NavigationController stack gives 2 pages

  17. 17

    Pushing divs to a new line on mobile view

  18. 18

    Why does single line text have new line?

  19. 19

    Why I cannot restore system image onto new hard drive?

  20. 20

    Why is the text pushing down the picture?

  21. 21

    Make the panels go onto the new line when the resolution changes

  22. 22

    pushing the new view controller (programatically) doesnt work ? why?

  23. 23

    Why is the text in an email sent via php being put on a new line?

  24. 24

    Why is one child div pushing pushing another child down below it?

  25. 25

    add text to div. New line

  26. 26

    Card not pushing onto to the Navigation stack, why not? Is there a limit?

  27. 27

    For every new text line separate, put that line into a div tag

  28. 28

    Why is inline-block pushing my div down:

  29. 29

    The paragraph is going onto a new line after the link in HTML

HotTag

Archive