开发者

Displaying an image as a block element?

开发者 https://www.devze.com 2023-03-24 03:44 出处:网络
I don\'t understand conceptually in what cases you would display an image as a block element. Can someone explain in what cases the display: block property 开发者_Python百科is most effective?You\'ll o

I don't understand conceptually in what cases you would display an image as a block element. Can someone explain in what cases the display: block property 开发者_Python百科is most effective?


You'll often want image as a block-element when you want to add vertical padding and/or margin.

You'll want them as block when you want them to be "alone" in their "row" (not surrounded by other element).

Other case include when you want to float them, or whatever case isn't about having them inline.

It's easier to carefully place around block element then inline element.


Images are already a block element

€dit: I stand corrected. They are not ;)

However, Block elements are usefull when you also need margin-top and bottom, aswell as automatic linebreaks before and after them

0

精彩评论

暂无评论...
验证码 换一张
取 消