skip to Main Content

It looks like the height of an empty display: inline element is different in Chrome vs Firefox. Is this a bug or WAI (e.g. Chrome vs Firefox interpreting some spec differently)?

Additionally, is there a conventional way web developers resolve this?

// Logs 0 in Chrome, non-0 in Firefox.
console.log(document.querySelector('bar').getBoundingClientRect().height);
<foo>
  <bar></bar>
</foo>

2

Answers


  1. console.log(document.querySelector('bar').getBoundingClientRect().height);
    bar {
      display: inline-block;
      height: 30; 
    }
    <foo>
      <bar>Some content or styling</bar>
    </foo>
    Login or Signup to reply.
  2. The amount of spaces or tabs used for indentation has an impact on Python. Combining tabs and spaces can also lead to problems. When making your selection, stick to a standard of four spaces for each degree of indentation.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search