span里面放文字还是放图片还是放其它东西才符合标准呢?
Suppose, for example, that we wanted to generate an HTML document based on a database of client information. Since HTML does not include elements that identify objects such as "client", "telephone number", "email address", etc., we use DIV and SPAN to achieve the desired structural and presentational effects. We might use the TABLE element as follows to structure the information:然后,在HTML5对于SPAN的文档定义中,Client information:
Last name: Boyera First name: Stephane Tel: (212) 555-1212 Email: sb@foo.org
Client information:
Last name: Lafon First name: Yves Tel: (617) 555-1212 Email: yves@coucou.com
The span element doesn't mean anything on its own, but can be useful when used together with the global attributes, e.g. class, lang, or dir. It represents its children.++) {
In this example, a code fragment is marked up using span elements and class attributes so that its keywords and identifiers can be color-coded from CSS:<code class="lang-c"><span class="keyword">for</span> (<span class="ident">j</span> = 0; <span class="ident">j</span> j</code>Nach dem Login kopieren
Contexts in which this element can be used:这里提到了个phrasing content 这个东西;而这个东西它介绍到:
Where phrasing content is expected.
Phrasing content is the text of the document, as well as elements that mark up that text at the intra-paragraph level. Runs of phrasing content form paragraphs.
As a general rule, elements whose content model allows any phrasing content should have either at least one descendant Text node that is not inter-element whitespace, or at least one descendant element node that is embedded content. For the purposes of this requirement, nodes that are descendants of del elements must not be counted as contributing to the ancestors of the del element.注②:inter-element whitespace :1. 内容为空的text结点 2.由space characters构成的text结点 , 这两类text结点会被认为是inter-element whitespace (space characters大致就是实现 space 键,tab键等功能的特殊字符)
Most elements that are categorized as phrasing content can only contain elements that are themselves categorized as phrasing content, not any flow content.
The space characters are always allowed between elements. User agents represent these characters between elements in the source markup as text nodes in the DOM. Empty text nodes and text nodes consisting of just sequences of those characters are considered inter-element whitespace.The space characters, for the purposes of this specification, are U+0020 SPACE, U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), U+000C FORM FEED (FF), and U+000D CARRIAGE RETURN (CR).
Embedded content is content that imports another resource into the document, or content from another vocabulary that is inserted into the document.
- audio ,
- canvas ,
- embed ,
- iframe ,
- img ,
- math ,
- object ,
- svg ,
- video
1 避免点击块状显示标签时,产生误操作
如之类的标签,客户端浏览器会自动给block属性,本来点击h1包住的标题才会触发动作,在点击标题外但仍处在h1横条范围内的地方,也会触发。像这种情况,给
等再加一个就可以解决。
2 让元素保持在一行
在某些元素后面再加上其他的不同格式的内容,但不想它到下一行,只能用嵌套。 http://www.cnblogs.com/myparamita/archive/2011/02/15/1954838.html米粽一些元素的修饰常常就是用span
inline内容的容器,包裹任何inline内容都是符合标准的。
引用自 http://w3.org/TR/html4...The DIV and SPAN elements, in conjunction with the id and class attributes, offer a generic mechanism for adding structure to documents. These elements define content to be inline (SPAN) or block-level (DIV) but impose no other presentational idioms on the content. Thus, authors may use these elements in conjunction with style sheets, the lang attribute, etc., to tailor HTML to their own needs and tastes.
因为是内联不是块级,所以不会对破坏文档流 span 做为内联元素来使用,另外也可以做为JS交互。内联元素有:span,em,strong,small,del等等。 内联元素 没什么意义 一般我都是用来跟JS交互用的 他本身没有什么功能,但用span标签选中后可以用ccs对选中的内容进行统一的格式上的修改。 对特定内容进行格式编辑。