Forums

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

Home Forums CSS Float: Brain Teaser!

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #38754
    jmirick
    Member

    Code below. It is super simple. Add and remove the p selector and watch what happens.

    Can some one explain to me *why* adding overflow auto to the p makes it not wrap under the img?

    I understand what is happening, not the why.

    If the answer says anything about float clearing, explain how that works in this case:

    • I have typically used float clearing to expand parent boxes to enclose their children.
    • Why doesn’t the p clear the img entirely?
    • Why does it look like it does?







    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce magna velit, feugiat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce magna velit, feugiat.




    #105307
    wolfcry911
    Participant

    it changes the block formatting context of the p

    http://www.w3.org/TR/CSS2/visuren.html#block-formatting

    #105319
    jmirick
    Member

    hummm.. thank you. I just learned something new, which will change how I code.

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