gpt4 book ai didi

javascript - 什么会导致 Bootstrap 将额外的元素插入到我的文档中?

转载 作者:行者123 更新时间:2023-11-29 18:18:50 25 4
gpt4 key购买 nike

我正在尝试为 <div> 创建功能区覆盖使用 CSS 和 Bootstrap 的字形图标。我能够毫无问题地自行构建功能区(我认为!),但是当我尝试放置字形时 <i>作为功​​能区文本,我最终得到了一个额外的 <i>在每个 <div> 之后神奇地插入元素在页面上。使用常规文本而不是 <i>按预期工作。

enter image description here

在使用 Chrome 和 Firefox 的 Ubuntu 上看到。

JSFiddle:http://jsfiddle.net/57Wbd/3/

<body>
<div class="box">
<div class="ribbon">
<div class="txt">
<i class="glyphicon glyphicon-exclamation-sign"/>
</div>
</div>
</div>
</body>

.box {
position: relative;
background-color: #808080;
width: 355px;
height: 132px;
}
.ribbon {
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
border: 48px solid transparent;
border-bottom: 48px solid #ffe500;
position: absolute;
top: -32px;
right: -72px;
width: 192px;
color: white;
}
.ribbon .txt {
position: absolute;
top: 16px;
}

这里可能发生了什么,我该如何解决?

最佳答案

使用 validator .

<i> 的结束标记不见了。错误恢复关闭并重新打开它,这样您所有其他内容的每一部分都有一个。

您不是在编写用作 application/xhtml+xml 的 XHTML 文档因此你不能使用 <foo />作为 <foo></foo> 的替代品.

(和 you shouldn't use an <i> for that anyway )。

关于javascript - 什么会导致 Bootstrap 将额外的元素插入到我的文档中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20766526/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com