扫码关注官方订阅号
项目需求 网页高度必须一屏, 适配不同屏幕的高度,各个模块的之间的间距随着各种屏幕高度的大小变化而变化,求 相关案例的可以参考一下,或者实现思路。
业精于勤,荒于嬉;行成于思,毁于随。
宽度高度不要写死,用百分比来实现,自适应思想
用媒体查询为不同屏幕高度设置不同的css。
<!DOCTYPE html> <title>hei</title> <style> html { height: 100%; } body { margin: 0; height: 100%; position: relative; } section { height: 33.333%; background: #ddd; } section::after { content: '\200b'; display: block; height: 5%; background: #fff; } section:first-child::after { display: none; } </style> <section></section> <section></section> <section></section>
你可以参考下semantic的关于responsive的间隔处理方式
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
宽度高度不要写死,用百分比来实现,自适应思想
用媒体查询为不同屏幕高度设置不同的css。
你可以参考下semantic的关于responsive的间隔处理方式