创建一个“插图”在网站中使用 CSS 效果
许多最新网站中的“插图”效果给我留下了深刻的印象。一些例子是
和
线在中心。如今,许多网站都使用此类线条/效果。
我尝试用边框实现相同的效果,但颜色组合对我不起作用,而且不正确。
其他网站是否使用这些图像?这容易吗?
有CSS示例吗?
示例站点: http://woothemes.com,http://net.tutsplus.com/,http://www.w3schools。 com (在标题中)和 WordPress 管理页面侧边栏中
I am very much impressed by the "inset" like effect in many latest websites. Some examples are
and
The line in the center. Nowadays, many websites use these kinds of lines/effects.
I tried to achieve the same with borders but the color combination is not working me and it is not proper.
Do other websites use images for these ? is it easy to this ?
Any example css ?
Example sites:
http://woothemes.com, http://net.tutsplus.com/ , http://www.w3schools.com (in the header) and in wordpress admin page sidebar
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
不知道这是否有帮助,但使用比 2 个相邻元素的背景稍亮和稍暗的 1 像素边框可以模拟这一点。例如:
编辑:
作为旁注,在上面的示例中切换明暗将为您带来轻微凸起/浮雕的边框效果。
Don't know if this will help, but using 1 px borders that are slightly lighter and darker than the background of 2 adjacent elements can emulate this. For Example:
EDIT:
As a side note, switching light and dark in the example above will give you a slightly raised/embossed border effect.
使用
非常聪明。跟进 user1302036 的回答,我们需要的只是设置
< 的顶部和底部边框的颜色;hr>
并将左右边框宽度设置为 0。Using an
<hr>
is quite clever.Following up on user1302036’s answer, all we need is to set the color of the top and bottom borders for an
<hr>
and set the left and right border widths to 0.使用 border-bottom 和 box-shadow。
查看 Fiddle 和 box-shadow 属性的浏览器兼容性。
Use border-bottom and box-shadow.
Check out the Fiddle and Browser Compatibility for box-shadow property.
2D 计算机显示器中的 3D 效果仅仅是通过使用颜色实现的光学效果:较浅的变化表明明亮(较高的区域),较暗的变化表明阴影(较低的区域)。大多数人都是惯用右手的,书写灯往往位于桌面的左侧,因此您可以在屏幕的左上角使用一个假想的光源。
多年来,我们已经可以在矩形区域中使用纯 CSS 来实现这一点:
然而,字体需要较新的 CSS 属性,这些属性尚未得到广泛支持,而且不允许提供超过一种颜色,因此通常使用图像。请参阅http://www.quirksmode.org/css/textshadow.html
3D effects in 2D computer displays are mere optical effects accomplished by the use of colour: lighter variations suggest bright (higher areas) and darker variations suggest shadown (lower areas). Most people is right-handed and writing lights tend to be on the left side of the desktop, so you use an imaginary source of light in the left top corner of the screen.
It's been possible to do it with pure CSS in rectangular areas for years:
Fonts, however, require newer CSS attributes that don't have wide support yet and, also, do not allow to provide more than one colour, so it's common to use images. See http://www.quirksmode.org/css/textshadow.html
这是 css 文本阴影属性。为了获得此效果,请使用
,但实际上这是您在背景和文本中使用的颜色组合的效果。
所以你应该这样做。
this is css text shadow property.for get this effect use
but really this is effect of color combination that you are using in background and text.
so you should do.
只需执行以下操作:
调整不透明度和颜色以适合您的设计,它适用于我认为的所有背景;)
Simply do the following:
Play with opacity and colors to suit your design, It works on all backgrounds I think ;)
最简单,画一条水平线
with the following styles, contrast can be modified depending on background color:
Easiest, draw an horizontal rule
with the following styles, contrast can be modified depending on background color:
这是一个可以使用的更当前、更灵活的解决方案。
JSFIDDLE
通过使用 RGBA(红、绿、蓝、Alpha),您可以使用带有 alpha(不透明度)的白色/黑色)以产生插入效果的错觉。
Here is a more current and flexible solution that can be used.
JSFIDDLE
By using RGBA(Red, Green, Blue, Alpha) you can use white/black with an alpha(opacity) to make the illusion of an inset effect.