0

I have some divs floated left like this:

<div style='float: left;'>First div</div>
<div style='float: left;'>Second div</div>
etc.

Everything seems ok. But when i change screen size so that last element in a line i just very near the edge of the browser window, or elements just have the widths that make them put last element to the border than browser is like:

Hm... ok. This last element seems to have so little space. I need to do something to cheer this element up. I could move this element to new line and everyone would be happy. But this element deserves better than that. I will leave it where it is, but i will move it slightly lower, so it can enjoy being special. It will now become the most outstanding element on this website.

And yes. Maybe browser is good to compensate last element the lack of space. But it does not look good to me. Since, for me, every element should be equally aligned in lines. No place for extravert elements on my site! But look, this element is extravert like hell:

The most extravert div ever

So my question is: what to do to move "psychology" into the line with "infatuation" and "friendship"?

I'd appreciate a solution for floating elements without changing display style to tableish one or changing divs into inline blocks if possible.

Tom Smykowski
  • 25,487
  • 54
  • 159
  • 236
  • Possible dublicate of http://stackoverflow.com/q/218760/3880255 – Clemens Himmer Jan 15 '16 at 09:38
  • @Tarekis this has nothing to do with clearfix, he wants all the elements in one line and not on the other line – Mr. Alien Jan 15 '16 at 09:40
  • Well, good thing i said "possible", wasn't sure, good you know more about that than i do :) – Clemens Himmer Jan 15 '16 at 09:42
  • @tomaszs : write media query for small width. In the media query, reduce the font-size and padding so that the element fits well in the container. – Jinu Kurian Jan 15 '16 at 09:52
  • @Jinu Kurian I can not predict the number of elements nor the size of them. Therefore if screen is small i want items to form new lines. I don't want to make elements smaller since: a) they will become hard to read on small devices b) sometimes there are a lot of elements and even if i did it it still can occur that it does not fit one line. – Tom Smykowski Jan 15 '16 at 09:55

0 Answers0