Displaying an image as a block element?
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
精彩评论