[CSS3] Make a horizontal-scrolling Menu
2024-08-30 03:14:03
Our web app on desktop may use elements that use great deal of width. On many occasions we can’t simply turn these elements into columns so that they fit on a small screen. Such elements may not only fit inadequately on small screens, they could ruin the entire layout of our page if we’re not careful. In many cases, we can use a horizontal-scrolling menu to preserve the width, but keep it easily usable.
<nav>
<a href="">Home</a>
<a href="">My Profile</a>
<a href="">Favorites</a>
<a href="">Links</a>
<a href="">Tasks</a>
<a href="">Promotions</a>
<a href="">Settings</a>
</nav>
nav {
display: flex;
overflow-x: auto; /*Allow children in nav can overflow in x direction*/
-webkit-overflow-scrolling: touch; /*Let the scroll more smoothing*/
margin: 10px 0;
} a {
margin-right: 20px;
margin-bottom: 10px;
white-space: nowrap;
}
最新文章
- 贝赛尔曲线UIBezierPath(后续)
- CoreGraphics-线段常见属性及渲染模式介绍
- Storm入门1-基本概念
- Sql服务定时重启
- 在VPS上搭建SS访问火星
- 自定义ViewGroup
- Java学习笔记(六)
- asp.net 错误跳转
- Ubuntu下MySQL忘记root密码重置
- SequoiaDB 与 Hive 集成
- php中运用GD库实现简单验证码
- hdu 5641 King&#39;s Phone(暴力模拟题)
- python模块介绍- xlwt 创建xls文件(excel)
- 解决MSSQL 2008不能用IP登录的问题
- Single Number leetcode
- WPF 快捷方式
- Windows资源
- pwd
- .NET Core实战项目之CMS 第十二章 开发篇-Dapper封装CURD及仓储代码生成器实现
- 自建 Gitlab (邮箱配置、拆分 PostgreSQL、Redis) + 随想