Home >Web Front-end >HTML Tutorial >Invalid solution for setting img image height to percentage

Invalid solution for setting img image height to percentage

WBOY
WBOYOriginal
2016-07-11 08:44:032545browse

When using percentage as the width and height, because the percentage is relative to the width and height of its nearest parent element, first its parent element must have a width and height. The width is generally not set and will have a default value (such as the width of the entire screen). However, if the height is not set, there will be no default value. Therefore, if the parent element does not set a height value and its internal element uses a percentage as the height, it will have no effect

Statement:
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