Problem with img being centered in div

WBOY
Release: 2016-09-27 14:05:21
Original
1309 people have browsed it

Img is an inline element. To set its margin attribute to center it, convert it to a block element display:block; and then use margin:0 auto; to achieve horizontal centering of the image; (Some designers add A div tag, and then center it through the margin of the div tag).

If the image is in the span attribute under the div, it must be converted to display: block; then padding-top: 10px.

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!