Home > Web Front-end > HTML Tutorial > Can the p tag and label tag be juxtaposed in html?

Can the p tag and label tag be juxtaposed in html?

黄舟
Release: 2017-07-03 11:53:59
Original
4318 people have browsed it

Strictly speaking, can the p tag and label tag be juxtaposed? If we follow the principle that block elements are juxtaposed with block elements, and inline elements are juxtaposed with inline elements, it means they cannot be juxtaposed, right?

Are the only child elements that can be nested in the p tag only inline elements? Can span tags be nested inside span tags?

Please point out the nesting problem in my code, thank you

<div class="title">
            <div> 
                <span class="span1"></span>
                <a class="a1" href="##">影评人</a>
                <span class="span1"></span>
            </div>
            <div class="right-box">
                <span class="span2"></span>
                <a href="#">
                    <span class="span3">|红人<span style="color:red">访</span>
                    </span>
                </a>
                <a href="">
                    <span class="span3">影评<span style="color:red">人</span>
                    </span>
                </a>
            </div>
        </div>
Copy after login

Don't stick to the rules of the HTML4 stage and experience based on the CSS level, it is of little significance. Strictly speaking, they can be paralleled. There is no nesting problem with your code either.

Block elements can contain inline elements or certain block elements, but inline elements cannot contain block elements. It can only contain other inline elements. 2. Block-level elements cannot be placed inside

There are several special block-level elements that can only contain inline elements and cannot contain block-level elements. These special tags are h1, h2, h3, h4, h5, h6, p, dt

Block-level elements are juxtaposed with block-level elements, and inline elements are juxtaposed with inline elements:

<div><h2></h2><p></p></div> —— 对
<div><a href=”#”></a><span></span></div> —— 对
<div><h2></h2><span></span></div> —— 错
Copy after login

The above is the detailed content of Can the p tag and label tag be juxtaposed in html?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template