SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2008
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question float allows inline element to take height?

    hi,

    i am trying out the things with ul and li for horizontal items.

    I have given a background image for li. these li items are not taking the height, as I have given the display:inline. that's ok, but when i give them the float:left, and then apply height, it is taking the height. now how is that? float allows an inline element to take the height?

    thanks.

  2. #2
    Design Your Site Team bronze trophy Erik J's Avatar
    Join Date
    May 2007
    Location
    Countryside, Sweden
    Posts
    3,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, floating objects allways has a block display and takes height and width. And without lengths given it shrinkwraps to content lengths.
    Happy ADD/ADHD with Asperger's

  3. #3
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,269
    Mentioned
    50 Post(s)
    Tagged
    2 Thread(s)
    position: absolute also turns inlines into blocks, also shrink-wrapping like float-blocks do, and also without collapsing margins.

    Why you never need to say "display: block" on either floats or absolutes.

  4. #4
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,656
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

  5. #5
    SitePoint Enthusiast
    Join Date
    May 2008
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •