Home > Web Front-end > HTML Tutorial > What are the benefits of writing like this in css_html/css_WEB-ITnose

What are the benefits of writing like this in css_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:09:41
Original
1122 people have browsed it


Why add a

?
Can’t you just omit it?
What to say? ? < p>

This means that img occupies a separate line of space, which means that img becomes a block-level element.

In fact, practical styles can also be implemented, that is, img style="display:block" becomes a block element.
It depends on the specific situation,

I guess this is to give the img a background color

p {

background:#eee;padding:2px;
}

This way the img looks like it has a border

Sometimes this is automatically added by some editors, and it can be completely removed. As the classmate above said, if you need to directly specify the style of the block, just specify it

This way, you can see the specific application. Judging from this line of code, it doesn’t matter whether you add a p element or not. If the content of the entire div is more complex, nesting a p element outside the img will allow you to use CSS to control the style more flexibly. For example:





Analyze specific problems in detail, as long as the results can be achieved.


Just such a line of code can’t tell anything. I feel like it was added automatically by the editor and has no special meaning.

I don’t think the p here means much. . . . There is no advantage, and now many block-level elements that require line wrapping can be replaced with css: display: block. . .

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