Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS A simple float question

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #146746
    sturdybubbles
    Participant

    Have a look at this example pen:

    http://codepen.io/benpearson/pen/bHJke

    QUESTION: Is it possible to get div Four and Five to move up beside div Two without changing the order of the divs in the HTML or using absolute positioning?

    Any help much appreciated.

    #146753
    wolfcry911
    Participant

    There are a couple of things you could do.

    One would be to not float Four or Five at all and remove their width. They would be full width, but the other floats would take up the left 75% and leave Four and Five to right of Two.

    Another would be to give Four a top margin of -55px and Five a top margin of -35px. This would require that div Two and have a known and static height.

    #146754
    sturdybubbles
    Participant

    Thanks very much wolfcry911.
    I also discovered changing divs four and five to be display:inline-block; instead of float:right; works too.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘CSS’ is closed to new topics and replies.