p标签作为父是越来越奇怪 [英] p tag as parent is getting weird

查看:88
本文介绍了p标签作为父是越来越奇怪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用p标签作为父级并添加了几个元素。但是问题是,当你看看检查代码p标签是单独显示,并且它不把孩子放在里面。

I am using p tag as parent and adding few elements in it. But the problem is, when you look at inspect code p tag is displaying individually and it is not holding the childs inside.

她是html

<div class="createapp_div">
                 <p><h1>Select</h1> <button class=""></button> <button class=""></button></p>
                 <p><span>Name</span> <input type="text" /></p>
                <button>Create</button>
            </div>

FIDDLE

FIDDLE

推荐答案

说明



p DOM元素只能包含内联元素。 ( MDN )(W3C HTML5

Explanation

The p DOM Element can only contain inline elements. (MDN) (W3C HTML5)


开始标记是必需的。如果< p> 元素紧接着是< address> ,则结束标记可以省略, code>< article> ,< aside> < blockquote> < div> < dl> < fieldset> / code>,< footer> < form> ; h1> < h2> < h3> < h4> < h5> < h6> < header> < hr> < menu> < nav> < ol> < pre ; < section> < table> < ul> 或另一个< p> 元素,或者如果父元素中没有更多内容, < a> 元素。

The start tag is mandatory. The end tag may be omitted if the <p> element is immediately followed by an <address>, <article>, <aside>, <blockquote>, <div>, <dl>, <fieldset>, <footer>, <form>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <header>, <hr>, <menu>, <nav>, <ol>, <pre>, <section>, <table>, <ul> or another <p> element, or if there is no more content in the parent element and the parent element is not an <a> element.





$ b b

允许的标签



以下是允许的标签的详细列表

内容:

< abbr>,< audio>,< b& ; bdo>,< br>,< button>,< canvas>,< cite> ;,< code>,< command> ;,< datalist>,< dfn> ;嵌入>,< i>,< iframe>,< img>,< input>,< kbd>,< keygen>,< label>,< mark> ;,< math> ; meter>,< noscript>,< object>,< output>,< progress>,< q> ;,< ruby​​> ;,< samp> ;,< script> ;,< select> ;小>,< span>,< strong>,< sub>,< sup>,< svg>,< textarea>,< time>,< var> ;,< video> ; wbr> 和纯文本(不仅包含空格字符)。

<abbr>, <audio>, <b>, <bdo>, <br>, <button>, <canvas>, <cite>, <code>, <command>, <datalist>, <dfn>, <em>, <embed>, <i>, <iframe>, <img>, <input>, <kbd>, <keygen>, <label>, <mark>, <math>, <meter>, <noscript>, <object>, <output>, <progress>, <q>, <ruby>, <samp>, <script>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <svg>, <textarea>, <time>, <var>, <video>, <wbr> and plain text (not only consisting of white spaces characters).

这篇关于p标签作为父是越来越奇怪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆