【问题标题】:What happens if use I undefined HTML tags instead of div In My Web [duplicate]如果在我的 Web 中使用我未定义的 HTML 标签而不是 div 会发生什么 [重复]
【发布时间】:2021-10-23 02:05:03
【问题描述】:

如果我们使用会发生什么

<container>
   <red>I'm Red If Working 100%</red>
</container>

而不是使用

<div class=container>
   <div class=red>
     I'm Red If Working 100%
   </div>
</div>

无论如何 CSS 和 JS 都可以工作

$("red").on("click", function(){ alert("Working 100%") });
container{
  position:absolute;
  top:0;
  left:0;
  right:0;
  bottom:0;
  overflow:auto;
}
red{ color:red; }
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<container>
   <red>I'm Red If Working 100%</red>
</container>

如果我们使用这些会有什么问题吗?

【问题讨论】:

  • 是的,至少一周后我得到了答复,谢谢

标签: html tags undefined


【解决方案1】:

实际上&lt;container&gt; 是一个具有一些附加属性的 div 块。

Container:与 Div 相同,但锁定为 960 像素宽度并自动放置 在页面中心

所以它当然可以在 JS 和 CSS 中正常工作

【讨论】:

  • 哦,无论如何我们可以使用undefined 标签,而不是像container。我的意思是如果使用这些会有什么问题
猜你喜欢
  • 2011-04-27
  • 2016-07-10
  • 2013-10-07
  • 2017-11-08
  • 2015-01-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多