Ask what is the difference between p and SPAN? Many of my friends must have only a little knowledge of it. Here I can tell you that the biggest feature of the p and SPAN elements is that by default, no formatting is performed on the objects within the elements.
Question: What is the difference between p and SPAN? ?
Answer: Solution:
The biggest feature of the p and SPAN elements is that by default, the objects within the elements are not rendered in any format. Mainly used for applying style sheets. The most obvious difference between the two is that p is a block element, while SPAN is an inline element (also translated as inline element).
Specific steps:
1. The so-called block elements are elements that start rendering on a new line. Inline elements do not need to start on a new line. Test the following code and you will have a more vivid image. Understanding:
Test<span>Follow the previous "test" display</span><p>A new line will be displayed here</p>
2. Block elements and inline elements are not static. By defining CSS display attribute values can be converted into each other, such as:
Test<p style="display:inline">Follow the previous "test" display</p><span style="display:block"> ;A new line will appear here to display
Tips: If you do not define any CSS attributes on the p element, the display effect will be on the P element.
Because of the particularity of p and SPAN elements, they are generally used to apply style sheets. For example, they are defined as layers using CSS. What needs to be distinguished is the difference between block elements and inline elements, as well as the differences between the two. Transform each other.
pSpecify the container for rendering HTML.
SPAN specifies an inline text container.
In general, a p occupies a block, and its default display attribute is block, indicating a block. For example:
aaa
bbb is displayed with two lines.For more analysis and explanation of the difference between div and span, please pay attention to the PHP Chinese website!