- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是一名 JavaScript 初学者,我正在构建一个小的选择函数。我想以小块的形式显示我的 li,当选择这些小块时,会添加不同的背景颜色。
我的 ul 遇到问题,我无法删除元素符号以将我的元素放入正确的行中。它以级联方式显示它,我不知道为什么,即使我使用了 list-style-type:none;
如果您想看一下,这是我的代码:
var part = document.querySelector('#part-list ul');
function clickHandlerPart(e) {
if (n == 1) {
if (e.target.tagName !== 'LI') {
console.log(e.target);
if (e.target.className == "addpart") {
console.log('selected');
e.target.className = 'removepart';
e.target.style.backgroundColor = '#9361bf';
e.target.style.fontSize = '20px';
e.target.style.marginLeft = '30px';
e.target.style.border = '1px solid #fff';
e.target.style.borderRadius = '4px';
e.target.style.padding = '10px, 10px, 10px, 10px';
e.target.style.float = 'left';
part.appendChild(e.target);
} else {
console.log('unselected');
e.target.className = 'addpart';
e.target.style.backgroundColor = '#fff';
}
n++;
console.log('****************');
}
} else {
n = 1;
return;
}
}
part.addEventListener('click', clickHandlerPart);
#parts {
margin-left: 30px;
display: inline;
white-space: nowrap;
}
#parts h2 {
text-align: center!important;
}
#parts ul {
list-style-type: none;
}
#parts li {
border: 1px solid #fff;
font-size: 20px;
}
.addpart,
.removepart {
float: left;
padding: 10px, 10px, 10px, 10px;
font-size: 20px;
margin-left: 30px!important;
}
<div id="part-list">
<h2>Which part(s) have you been working on today?</h2>
<ul>
<li>
<span class="addpart">Decoratives</span>
</li>
<li>
<span class="addpart">Windows</span>
</li>
<li>
<span class="addpart">Signage Gibela</span>
</li>
<li>
<span class="addpart">Signage Prasa</span>
</li>
<li>
<span class="addpart">Stripes</span>
</li>
<li>
<span class="addpart">Others</span>
</li>
</ul>
</div>
最佳答案
li
的元素符号可以由 ul
元素的 list-style
属性控制。
ul {
list-style: none;
}
关于javascript - 从李中移除子弹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60919074/
是否可以用按钮替换 ul 元素符号?我知道您可以使用 CSS 更改为图像,但如果我想要一个实际的元素呢? 最佳答案 这不可能如您所问,但您也许可以效仿它: some button textL
我在让元素符号显示在无序列表中时遇到了一些问题。如果我更改 css 以在内部显示元素符号,它们应该向上,但紧挨着文本。我的伙伴想要的是元素符号显示在框架的最左侧,并且在它和文本之间有几个标签值的空间。
我正在使用 the Orbit component of Foundation 5并想知道是否有办法将出现在幻灯片下方的元素符号移动到幻灯片本身的内容区域中。基本上,将元素符号放在图片上方。 有很多
我有一个从 wordpress 帖子生成的 ul li 边栏。客户为每个 LI 的元素符号使用了不同的图像。与其手动添加单独的元素符号,不如从一组(比如说 10 个)选项中进行选择? 正在考虑 Jqu
我有一个带有方向键和 2 个按钮的游戏 handle 。所有这些都是数字的(不是模拟的)。 我有一个处理他们的事件的程序: -(void)gamepadTick:(float)delta {
稍微注释掉后,我发现当我在 JavaScript 中运行此命令时,我的无序列表中的元素符号消失了(每个“页面”都是我的无序列表中的一个元素。): pages[i].style.display = "b
假设我想存储所有子弹,任何人在我的游戏中射击以计算每帧的新位置等。 如果有 10 名玩家,并且每个人的射击速率为每秒 10 次射击,我们可能需要在 10 秒后跟踪 1000 个物体。 我们确实知道,数
这是我所拥有的: import java.awt.Color; import java.awt.Component; import java.awt.Graphics; import java.awt
我正在通过 ant-design (antd) 库开发一个 reactjs 元素。我想在我的元素中使用 Carousel 组件。当我将内容的背景色 - 应显示在轮播内 - 设置为#FFF 时,元素符号
我是一名优秀的程序员,十分优秀!