实例首页
自学教程
IT工具箱
源代码
下载代码
上下布局
点击运行 >
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>css 设置元素的高度 按百分比 实例 - 自学教程(runoops.com)</title> <style> html { height: 100%; } body { height: 100%; } img.normal { height: auto; } img.big { height: 50%; } img.small { height: 10%; } </style> </head> <body> <img class="normal" src="//demo.runoops.com/static/img/logocss.gif" width="95" height="84" /><br> <img class="big" src="//demo.runoops.com/static/img/logocss.gif" width="95" height="84" /><br> <img class="small" src="//demo.runoops.com/static/img/logocss.gif" width="95" height="84" /> </body> </html>
运行结果: