Languages

CSS - what is default display property value of HTML element?

3 points
Asked by:
Paris-Bateman
504

What is the default CSS display property value of HTML element?

I can't check it like this:

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<body>
  <div id="my-element">My element</div>
</body>
<script>
  
  var myElement = document.querySelector('#my-element');

  console.log(myElement.style.display);

</script>
</html>
1 answer
3 points
Answered by:
Paris-Bateman
504

Default value of the display property depends on the element type. In HTML, we have block and inline elements. So by default display property value is block or inline depending on the element.

Block elements:

  • div
  • p
  • headers (h1 - h6)
  • form
  • section
  • header
  • footer
  • etc.

Inline elements:

  • a
  • span
  • img
  • etc.
0 comments Add comment
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join