Grow your CSS skills. Land your dream job.

childs wont fit in inline

  • # July 9, 2013 at 11:06 am

    Hi,

    lets say you have element with 300px width and two childs in it with 150px width, 0 padding, 0 margin and inline-block. Why they wont fit perfectly in one line? Same is with percentages. Someone can help, explain?

    # July 9, 2013 at 11:12 am

    Inline block unfortunately includes space for HMTL white-space.

    There are techniques for dealing with this…the easiest (possibly) is to set the font-size of the parent to 0.

    You will have to re-set the font-size for the children though.

    http://joshnh.com/2012/02/07/why-you-should-use-inline-block-when-positioning-elements/

    # July 9, 2013 at 11:14 am

    because they behave like words/letters as inline-boxes , and if opening and closing brackets of you tags do not touch each other , you have that space in between that shows up on screen.
    Different ways to fix , but the easiest is from HTML code , where every browser will do the same.

    Make tags touch themselves (as if you minify HTML code) or insert in between HTML comments

    # July 9, 2013 at 11:14 am

    Works perfectly, thank you, cheers!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".