Here is the story: I'm using SWFObject to insert a Flash object into my page. The embedding eats my span. So, I lose all my CSS for it. I was thinking of moving all of the CSS to the parent so I don't lose my CSS styles when the Flash appears.

I have tried using a span within a span, but I don't think it's working. Is there a reason for this? I don't understand why you could have div within a div but not a span within a span.

Does it have to do with spans being inline?

推荐答案

HTML4 specification states that:

Inline elements may contain only data and other inline elements

Span is an inline element, therefore having span inside span is valid. There's a related question: Can <span> tags have any type of tags inside them? which makes it completely clear.

HTML5 specification (including the most current draft of HTML 5.3 dated November 16, 2017) changes terminology, but it's still perfectly valid to place span inside another span.

Html相关问答推荐

有没有一种方法可以用css和html在桌面上并排显示列,在移动设备上显示一个下方的列?

创建一个带有div和径向渐变的全宽半圆

按钮之间的HTML文本居中不正确

穿过整个屏幕的旋转线

默认情况下使用Disbale Scroll,但在单击图标后将其激活

Chrome浏览器错误:上的主题验证判断https://pagead2.googlesyndication.com/失败

目标第一个祖先标签的 XPath

来自元标记的响应文本

为什么带有截断的 contentedible div 在受约束时会在 Chrome 中添加空格

如何使用 HTML 将对象数组发送到 Nodejs Express

标题在实时网站上闪烁

在 html 和 css 中绘制表格内的倾斜线

为什么 CSS 网格超出了父级?

排列卡片时遇到困难

在DIV上应用梯度模糊未如预期工作

网页设计不适合移动设备

如何只为 Navbar 中的一个元素提供动画,其余元素没有使用 css 的动画

更改标签标签的大小

文本输入在 Chrome 中保持水平滚动,带有文本溢出:省略号

水平滚动框不显示所有元素