帮助创建带有弯曲标题部分的 HTML 页面
我想知道,创建一个顶部标题部分看起来是斜角而不是直角的网页的最佳方法是什么(使用 html、css 和图形)?请参阅下图作为示例:
我不确定如何使用图像,以便它们会根据不同的浏览器大小/分辨率扩展/收缩...
任何人都可以为我提供一些帮助吗?或者也许给我指出一个资源?
谢谢!
I was wondering, what is the best way (using html, css, and graphics) to create a web page whose top header section appears to be beveled, as opposed to straight across? Please see the below image as an example:
I'm not sure how to use images in a way such that they would expand/contract in accordance with different browser sizes/resolutions...
Can anyone offer me some help? Or perhaps point me to a resource?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我的是 @Alex 的更简洁版本:
现场演示
显然它在 IE 中不起作用。
Mine is a cleaner version of @Alex's:
Live Demo
It obviously won't work in IE.
您可以使用
border-radius
。查看我的jsFiddle 上的示例。
You could use
border-radius
.See my example on jsFiddle.
这是一个跨浏览器版本,是我在 jquery 的帮助下制作的。基本上,该脚本创建了许多具有白色背景和递减宽度的跨度。
您可以使用
STEPS
和FACTOR
变量,这会改变结果。阶跃函数设置曲线的缓动。你稍后可以用比我更好的功能替换它,这只是一个例子。您可以在 小提琴)
Here's a cross-browser version, which i made with help of jquery. Basically, the script creates many spans, with white background and decreasing width.
You can play around with
STEPS
andFACTOR
variables, which will change the result. The step function sets the easing of the curve. You may replace it later with better functions than mine, it's just an example.You can find the entire code (html + css on the Fiddle)
您可以使用 CSS3 或 webkit 特定的属性,但就跨浏览器兼容性而言,这并没有得到很好的支持。如果您想支持尽可能多的浏览器,最好的选择是使用背景图像来实现此效果。
You could use CSS3 or webkit-specific properties, but this is not well supported as far as cross-browser compatibility is concerned. If you want to support as many browsers as possible, your best bet would be to use a background image to achieve this effect.
这是实现此目的的另一种方法。
宽度
和高度
大于元素本身。border-radius
来创建圆形效果和background-color
。overflow:hidden
以隐藏多余的部分。输出图像:
Here is another way of achieving this.
width
andheight
larger than element itself.border-radius
to create round effect andbackground-color
.overflow: hidden
on parent to hide excess part.Output Image: