<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <section id="sid"> JS判断html元素是行内元素还是行内元素 </section> <script> var oS =document.getElementById('sid'); console.log(window.getComputedStyle(oS).display) </script> </body> </html>