热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

45DegreeAngle+BoxShadow-UsingnothingbutCSS

IneedtorecreatethefollowingdesignusingonlyCSS:我只需要使用CSS重新创建以下设计:Whatyoureseeingin

I need to recreate the following design using only CSS:

我只需要使用CSS重新创建以下设计:

image

What you're seeing in the picture is the top of a website container - the "links" are part of the main menu.

您在图片中看到的是网站容器的顶部 - “链接”是主菜单的一部分。

As it stands, I've created the container but I'm not sure how to go about making the slant on the navigation without using an image.

就目前而言,我已经创建了容器,但我不知道如何在不使用图像的情况下在导航上进行倾斜。

For the record: I'd rather not use an image as the chances of the box shadow on the slant matching up with box shadow rendered by the browser are slim-to-none, especially when it comes to multiple browsers.

为了记录:我宁愿不使用图像,因为倾斜的盒子阴影与浏览器呈现的盒子阴影相匹配的可能性很小,尤其是涉及多个浏览器时。

I was thinking along the lines of a positioned and rotated div with a white background and a box shadow, but I haven't been able to build it yet.

我正在考虑一个带有白色背景和盒子阴影的定位和旋转div的线条,但我还没有能够构建它。

Any ideas?

有任何想法吗?

4 个解决方案

#1


28  

There is something called Sandpaper that can help you to transform your elements, even in IE!

即使在IE中,有一种叫做Sandpaper的东西可以帮助你改变你的元素!

.myDiv {
    -sand-transform: rotate(45deg);
}

You can just plug it into your site and you're set.

您只需将其插入您的网站即可。

Also you can use CSS3 transforms, which you asked about in your question: "Using nothing but CSS."

您也可以使用CSS3转换,您在问题中询问:“只使用CSS。”

To do this you'd use:

要做到这一点你要使用:

 .myDiv {
    -webkit-transform: rotate(45deg); 
    -moz-transform: rotate(45deg);  
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=5); /*for IE*/
}

And thanks to Josh and Robert for the Opera equivalent:

感谢Josh和Robert对Opera的等价:

-o-transform: rotate(45deg);

Internet Explorer will drop ClearType on any text that has a filter applied to it. But you can add empty extra element inside the main one and apply filter to this extra element. After this ClearType will be not ruined and the same result can be achieved.

Internet Explorer将在已应用过滤器的任何文本上删除ClearType。但是您可以在主要元素中添加空的额外元素,并将滤镜应用于此额外元素。在此之后,ClearType将不会被破坏,并且可以实现相同的结果。

#2


1  

For rotation, you're looking for:

轮换,你正在寻找:

-moz-transform:rotate(45deg);
-webkit-transform:rotate(45deg);

Keep in mind, that the rotation is a CSS3 attribute, so you're not going to get the same behavior across all browsers. Rather than making just the slant with an image, it would probably be better to recreate the whole outline. I'd approach it with:

请记住,旋转是CSS3属性,因此您不会在所有浏览器中获得相同的行为。而不是仅仅使用图像倾斜,重建整个轮廓可能会更好。我接近它:

  1. The header section, which would have the slant, shadow, the menu background and the padding at the top of the content, pretty much like your screenshot there.
  2. 标题部分,内容顶部有倾斜,阴影,菜单背景和填充,非常类似于你的屏幕截图。
  3. An image that can repeat-y down the entire body of content with a shadow.
  4. 可以使用阴影在整个内容中重复y的图像。
  5. The footer section.
  6. 页脚部分。

You can also use external libraries to attempt to recreate CSS3 attributes, but images may be the easiest way as you know how they'll render.

您也可以使用外部库来尝试重新创建CSS3属性,但是当您知道它们将如何呈现时,图像可能是最简单的方式。

#3


1  

I think you can use the techniques from http://nicolasgallagher.com/pure-css-speech-bubbles/demo/

我想你可以使用http://nicolasgallagher.com/pure-css-speech-bubbles/demo/中的技术

This is a really nice compilation and inspiration for using CSS. Enjoy.

这是一个非常好的编译和使用CSS的灵感。请享用。

PS: it is safer than CSS3 transforms.

PS:它比CSS3转换更安全。

#4


1  

Rotation seems unnecessary. I would try using a CSS triangle effect.

轮换似乎没必要。我会尝试使用CSS三角效果。

I'm going to assume your links are in a ul so your css could select ul:before and make it into the correct shape.

我将假设您的链接处于ul状态,因此您的css可以选择ul:之前并将其设置为正确的形状。

I don't know what will happen with the box-shadow but it might be worth a shot, and will probably be easier to align in IE without resorting to Javascript.

我不知道盒子阴影会发生什么,但它可能值得一试,并且可能更容易在IE中对齐而不需要求助于Javascript。


推荐阅读
  • 这是原文链接:sendingformdata许多情况下,我们使用表单发送数据到服务器。服务器处理数据并返回响应给用户。这看起来很简单,但是 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
  • ASP.NET2.0数据教程之十四:使用FormView的模板
    本文介绍了在ASP.NET 2.0中使用FormView控件来实现自定义的显示外观,与GridView和DetailsView不同,FormView使用模板来呈现,可以实现不规则的外观呈现。同时还介绍了TemplateField的用法和FormView与DetailsView的区别。 ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • 知识图谱——机器大脑中的知识库
    本文介绍了知识图谱在机器大脑中的应用,以及搜索引擎在知识图谱方面的发展。以谷歌知识图谱为例,说明了知识图谱的智能化特点。通过搜索引擎用户可以获取更加智能化的答案,如搜索关键词"Marie Curie",会得到居里夫人的详细信息以及与之相关的历史人物。知识图谱的出现引起了搜索引擎行业的变革,不仅美国的微软必应,中国的百度、搜狗等搜索引擎公司也纷纷推出了自己的知识图谱。 ... [详细]
  • WebSocket与Socket.io的理解
    WebSocketprotocol是HTML5一种新的协议。它的最大特点就是,服务器可以主动向客户端推送信息,客户端也可以主动向服务器发送信息,是真正的双向平等对话,属于服务器推送 ... [详细]
  • 导出功能protectedvoidbtnExport(objectsender,EventArgse){用来打开下载窗口stringfileName中 ... [详细]
  • 欢乐的票圈重构之旅——RecyclerView的头尾布局增加
    项目重构的Git地址:https:github.comrazerdpFriendCircletreemain-dev项目同步更新的文集:http:www.jianshu.comno ... [详细]
  • 本文介绍了响应式页面的概念和实现方式,包括针对不同终端制作特定页面和制作一个页面适应不同终端的显示。分析了两种实现方式的优缺点,提出了选择方案的建议。同时,对于响应式页面的需求和背景进行了讨论,解释了为什么需要响应式页面。 ... [详细]
  • 如何自行分析定位SAP BSP错误
    The“BSPtag”Imentionedintheblogtitlemeansforexamplethetagchtmlb:configCelleratorbelowwhichi ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 云原生边缘计算之KubeEdge简介及功能特点
    本文介绍了云原生边缘计算中的KubeEdge系统,该系统是一个开源系统,用于将容器化应用程序编排功能扩展到Edge的主机。它基于Kubernetes构建,并为网络应用程序提供基础架构支持。同时,KubeEdge具有离线模式、基于Kubernetes的节点、群集、应用程序和设备管理、资源优化等特点。此外,KubeEdge还支持跨平台工作,在私有、公共和混合云中都可以运行。同时,KubeEdge还提供数据管理和数据分析管道引擎的支持。最后,本文还介绍了KubeEdge系统生成证书的方法。 ... [详细]
  • 标题: ... [详细]
  • 本文介绍了Cocos2dx学习笔记中的更新函数scheduleUpdate、进度计时器CCProgressTo和滚动视图CCScrollView的用法。详细介绍了scheduleUpdate函数的作用和使用方法,以及schedule函数的区别。同时,还提供了相关的代码示例。 ... [详细]
author-avatar
空灵一_一_379
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有