css导航下面多个副导航

As I’ve shown previously, it’s completely possible to create an angled navigation using CSS transforms. As part of her new book, Lea Verou shows how to take that idea even further to create diamond frames for images. Inspired by that work, I created the navigation you see above: a series of active links, arranged in a pattern like a chain-link fence.

如前所述,完全有可能使用CSS转换创建角度导航 。 作为她的新书的一部分,莉亚·维鲁(Lea Verou)展示了如何进一步发展这一想法,以创建用于图像的菱形框架。 受到这项工作的启发,我创建了您在上方看到的导航:一系列活动链接,其排列方式类似于链节围栏。

图像作为钻石 (Images As Diamonds)

The central idea of the image diamond frame is fairly straightforward: I’d recommend reading Lea’s book for a complete (and more accurate) description of the method, along with further variations. Broken down into five steps, the basic technique is:

图像菱形框架的中心思想非常简单:我建议您阅读Lea的书,以完整(更准确)地描述该方法,并进行进一步的更改。 分为五个步骤,基本技术是:

步骤1:构图 (Step 1: Frame the image)

Most any element will work as a frame: in the example above I’m using <a> tags to create linked images. The <a> elements are made square by making them inline-block with a set height. I’ve also made the bitmaps square for ease of use, although that isn’t required.

大多数元素都可以用作框架:在上面的示例中,我使用<a>标记创建链接的图像 。 通过将<a>元素设置为inline-block并设置为height ,从而使它们成为正方形。 尽管不是必需的,但我也使位图成为正方形,以易于使用。

步骤2:旋转框架 (Step 2: Rotate the frame)

The frame is turned 45°, rotating the image and any other content inside it.

框架旋转 45°, 旋转图像和其中的任何其他内容。

步骤3:旋转图像以进行补偿 (Step 3: Rotate the image to compensate)

The content of the frame is rotated back by the opposite amount to keep it square. That’s why I’m using <img> tags rather than background images: there is (as yet) no background-transform.

框架的内容向后旋转相反的量以保持正方形。 这就是为什么我使用<img>标记而不是背景图像的原因 :目前还没有background-transform

第4步:缩放图像以填充空间 (Step 4: Scale the image to fill the space)

The squared-up image will not fill the diamond shape, so it is scaled up slightly to compensate.

平方的图像将不会填满菱形,因此会稍微放大以进行补偿。

步骤5:清除溢出 (Step 5: Remove overflow)

Set overflow: hidden on the element to trim any image excess from the outside of the frame.

设置overflow: hidden在元素上,以修剪掉框架外部多余的图像。

Chainlink背景 (Chainlink Backgrounds)

I wanted the three links to sit in the context of other diamond-shaped images. While it would be possible to create these using HTML and CSS, I decided to “cheat” and create it as a background image using PhotoShop.

我希望这三个链接位于其他菱形图像的上下文中。 尽管可以使用HTML和CSS创建这些文件,但我还是决定“作弊”并使用PhotoShop将其创建为背景图像。

Background for the diamond mesh navigation
菱形网格导航的背景

This simplified the markup for the gender-normative demo:

这简化了性别规范演示的标记:

<div id="pure-container"><a href="#" id="woman"><img src="woman.jpg" alt><span>Women</span></a><a href="#" id="man"><img src="man.jpg" alt><span>Men</span></a><a href="#" id="child"><img src="child.jpg" alt><span>Children</span></a>
</div>

Due to the fact that the links would be absolutely positioned, the pure-container had to be padded out. The complete CSS:

由于链接绝对定位 ,因此必须填充pure-container 。 完整CSS:

#pure-container { background: url(mesh-grid-background-2x.jpg);position: relative;padding-top: 68%;background-size: cover;overflow: hidden;}
#pure-container a { display: inline-block;position: absolute;width: 33%;height: 48.4%;transform: rotate(45deg);top: 0; overflow: hidden;opacity: 0.5;transition: .6s opacity;color: #fff;font-family: Avenir, sans-serif;text-transform: uppercase;letter-spacing: .2rem;font-size: .5rem;text-shadow: 0 0 5px rgba(0,0,0,0.4);}
#pure-container a:hover, #pure-container a.highlighted { opacity: 1;
}
#pure-container a span { display: inline-block;transform: rotate(-45deg);position: relative;z-index: 5;text-align: center;width: 100%;left: 25%;top: -36%;font-size: 2rem;
}
#pure-container a img { width: 100%;transform: rotate(-45deg) scale(1.4);
}

As I mentioned, each link must be positioned absolutely, using relative units so that the entire design remains responsive:

如前所述,每个链接必须使用相对单位进行绝对定位,以便整个设计保持响应速度 :

a#woman {margin-top: 3.2%;left: 34.4%;
}
a#man {margin-top: 26.4%;left: 11%;
}
a#child {left: 57.8%;margin-top: 26.5%;
}

There’s also some media queries to tidy up the presentation at smaller screen sizes; you can inspect that on the CodePen demo.

还有一些媒体查询可以在较小的屏幕尺寸下整理演示文稿。 您可以在CodePen演示中进行检查。

翻译自: https://thenewcode.com/1028/CSS-Diamond-Mesh-Navigation

css导航下面多个副导航

css导航下面多个副导航_CSS Diamond Mesh导航相关推荐

  1. html文件打开是搜索导航,GitHub - bituplink/OneHtmlNav: 单文件html的网络导航页面,简约并不简单...

    OneHtmlNav 这是基于小呆导航的超级精简版本,之所以投入了不少精力折腾这个导航,是之前自己网站的导航有点功能不足,看到了小呆导航有我需要的功能,但是确是基于CMS的,有点复杂我又不想再搭建一个 ...

  2. css字体的字型,CSS的字体、字型控制_css

    ★☆★使用css你可以对页面的字体进行任意的控制,比起html简直方便不知多少. CSS使用"font-size"属性来控制字体大小. CSS中可以使用的单位:points, pi ...

  3. 凯立德地图导航2020年最新版车载_明明有车载导航,为什么很多人还是选择用手机导航?有5个原因...

    提到导航,你首先会想到什么导航产品呢? 如果是高德导航.百度导航之类的,那你主要用手机导航. 但是如果除了高德导航和百度导航之外,你还能随口说出四维图新导航.凯立德导航,甚至是道道通导航之类的话,那你 ...

  4. layui导航栏页面滚动固定_网站建设页面导航如何降低用户寻找的时间

    做为正确引导客户体验网站的莱单导航栏,从检索视角上而言,也起着关键的功效,莱单导航栏不但联系网站的外界,也联系着网站主页面及其别的网页,是全部网站的"管理中心",因此网站建设中莱单 ...

  5. 门诊地图导航怎么做,零成本的医院室内导航解决方案

    现在很多医院都比较大,科室众多,往往让人不知道要找的科室在哪里,不了解看病的流程,只能去咨询台询问,费时又费力--电子地图作为大家最喜闻乐见的高效应用形式,可高效为病患提供导医服务,并为医院提供高效的 ...

  6. 院内导航方案怎么样,低成本的智慧医院室内导航一站式解决方案

    很多智慧医院的方案里都提到了院内导航,它俨然已经成为智慧医院套餐中的"招牌菜",甚至被打上了"导航神器"的绰号,其中电子地图作为大家最喜闻乐见的高效应用形式,可 ...

  7. IOS 滑动tableview,导航栏渐渐显示,搜索框显示在导航栏上

    先看下效果图 这样的效果图我们在很多app上也看到过,正好我们的项目中有需要,就来实现下. 该效果有两种解决方案: 一.自定义导航栏,在scrollViewDidScroll方法中,改变导航栏的颜色和 ...

  8. 地铁站室内导航的新实践-实景化第一人称三维导航

    阿里开发者工具       打造围绕开发者全生命周期的工具产品 https://developer.aliyun.com/tool?spm=a1z389.11499242.0.0.65452413km ...

  9. css表格文字超数量就竖排_CSS奇特技巧:控制文字竖排_css

    样式表的文字处理属性中有两个重要的属性:writing-mode和text-align.让我们先看看它们的用法: 1. writing-mode(设置对象书写方向) 语法:writing-mode : ...

最新文章

  1. share一下一线大厂是怎么招聘技术岗的?
  2. java中方法的参数传递
  3. ant design vue input change_Ant-design-vue项目实现动态路由
  4. JavaScript:从此不再怕闭包
  5. 在您的构建过程中添加微基准测试
  6. 如何识别哭泣csdn_如何让敏感的孩子,不再那么敏感?不是溺爱,而是懂得这些方法...
  7. POJ 2010 Moo University - Financial Aid【堆的应用】
  8. aix创建oracle表空间,Oracle for AIX基于裸设备的表空间扩充步聚
  9. 20165309 《网络对抗技术》实验二:后门原理与实践
  10. node-red 可视化_可视化和注意-第4部分
  11. 基于 React.js + redux + bootstrap 的 RubyChina 示例
  12. 海康威视摄像头重置密码
  13. 2022年计算机体系结构与软件工程国际会议(CASE 2022 )
  14. 制作自己的W7系统的主题包自己制作
  15. 处理MathType的兼容问题(下)
  16. 软件项目的规模、工作量和成本是如何进行估算或评估的?
  17. 如何将mac中的资料拷贝到U盘,移动硬盘(实用!!!)
  18. php个人发卡搭建教程,个人发卡平台ZFAKA程序搭建详细教程
  19. 360插件化方案RePlugin学习笔记-插件与宿主间的通信方式
  20. vue 使用 :class 根据不同状态值设置状态文字颜色不同

热门文章

  1. 459基于python的汽车维修零配件查询系统
  2. mysql 中 汉字根据首字母排序
  3. 计算机应用专业英语求职信,计算机应用专业英文求职信写作
  4. SQL Server 50道查询训练题,学生Student表
  5. kettle项目经验总结
  6. SLAM算法学习(2): SLAM原理理顺
  7. cad模型轻量化_国内首款:新一代基于云架构的三维CAD产品CrownCAD正式公测!
  8. 第十三篇、基于Arduino uno,获取薄膜压力传感器的值——结果导向
  9. 中望3D 2022 镶嵌
  10. 英国男子复制自家公寓造型为爱犬建犬舍