48

Question: What's the difference between display: block and display: inline?

Me: Thanks for your time...

Comments
  • 5
    It's 2 different state which can have different properties
    <body><footer> or <div> are block because.. they are a block
    <h1><strong><span> are type inline because there is no line return are the end of these
  • 2
    inline: document flow, meaning it goes with the text, doesn't break the line, doesn't have width/height properties but text-height instead.
    block: takes the whole horizontal space, default for images, tables, divs. Has specified width and height.
    If you want it to not break the line and have height/width you use "inline-block".
    Didn't mention flexbox since it's a more complicated display, try to figure these and experiment a little then read about flex box
  • 2
    @pagrette h1 is block.
  • 6
    Its wk48 folks, it doesn't warrant an explanation.
  • 0
    @pagrette and @lewdogg actually all h1 - h6 is block.
  • 1
    So was this a good question or a bad one? I think that it is a good question.
  • 2
    I'd say it'd be a valid question for a ~junior position. Higher thant that it could be interpreted as kinda insulting? I could be wrong, just got out of bed...
  • 0
    @PoweredByCoffee Oh I Thought It Was An Inline.. my bad
Add Comment