Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[html] 第174天 img、input标签它们是行内元素还是块级元素? #1315

Open
haizhilin2013 opened this issue Oct 6, 2019 · 4 comments
Labels
html html

Comments

@haizhilin2013
Copy link
Collaborator

第174天 img、input标签它们是行内元素还是块级元素?

@haizhilin2013 haizhilin2013 added the html html label Oct 6, 2019
@coconilu
Copy link

coconilu commented Oct 7, 2019

行内元素,也是替换元素。

@loveToMy
Copy link

行内元素

@boboZh
Copy link

boboZh commented Oct 17, 2019

行内块状元素

@luckyMuChen
Copy link

luckyMuChen commented Feb 20, 2020

结论:属于行内元素,也是替换元素(行内块元素)
详说

  1. 简单的说行内元素也就是display:inline的元素,行内块元素就是display:inline-block的元素,典型的有input
  2. 它们的关系我觉得行内块元素是行内元素的一个特殊的子集,这样子一个存在。
  3. 行内元素,只有设置左右的margin和padding,不能设置高宽,它的高度取决于内部文字的行高。宽度取决于内部文字的多少。
  4. 行内块元素和块级元素的属性基本一致。可以设高宽、边距。不同在于它允许左右存在元素。而块级元素就算只有1px也不允许有元素和它共享一行。
  5. 比如:button、input、 textarea、select、 img
  6. 可以自己尝试一下给它们设置高宽,边距,自己感觉一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
html html
Projects
None yet
Development

No branches or pull requests

5 participants