发新话题
打印

50个最实用的CSS技巧 样式欣赏

本主题由 iconsbox 于 2008-4-17 11:01 设置高亮

50个最实用的CSS技巧 样式欣赏

开发一个有独具创意的网站样式设计是一件非常辛苦的事,尤其是撰写编码需要花很多时间和精力解决许多遇到的不协调问题和寻找一些可能会遇到问题,这里收集了过去一年里常用的50个最实用的CSS -技巧。

感谢一切为CSS设计发展作出贡献的人。(via)

 

Sometimes being a web-developer is just damn hard. Particularly coding is often responsible for slowing down our workflow, reducing the quality of our work and sleepless nights with pizza and coffee laying around the laptop. Reason: with a number of incompatibility issues and quite creative rendering engines it sometimes takes too much time to find a workaround for some problem without addressing browsers with quirky hacks. And that’s where ready-to-use solutions developed by other designers come in handy.

One year ago we’ve published the post with 53 CSS-Techniques You Couldn’t Live Without where we provided references to the most useful CSS-techniques which are often used in almost every project. Over the last year we’ve been observing what’s happening with the CSS-based web-development, and we collected most useful CSS-techniques we’ve stumbled upon — for us and for our readers.

In this post we present 50 new CSS-techniques, ideas and ready-to-use solutions for effective coding. You definitely know some of them, but definitely not all of them. Some technique is missing? Let us know in the comments to this post.

Thanks to all developers who contributed to the CSS-based design over the last year. The community appreciates it.

CSS-Techniques

 

1. Triadic Background Setting with CSS
The Silverback web site uses three background images to create the illusion of 3D with simple CSS. No documentation is provided, however the source code is quite intuitive. [via Wilson Miner]

利用三张背景图片来创造一种错觉上的3D效果,非常的酷. [via Wilson Miner]

 

 

2. Creative Use of PNG Transparency in Web Design
With proper PNG support in Internet Explorer 7, and some handy JavaScript and CSS tricks to account for older browsers, we can use PNG images to greatly enhance our design vocabulary.

使用JavaScript和CSS技巧,让PNG透明图片能够IE7或其它一些较老的浏览器支持。

 

 

3. CSS Server-Side Pre-Processor

一个CSS幻灯片服务器的预处理器

 

 

4. Advanced CSS Menu

来自Nick.la创建的一个CSS菜单,帕兰看只要这样的CSS列表,基本都能收录到这个效果。

 

 

5. CSS SiteMap

非常直观的CSS网站地图,且利用错觉产生3D效果

 

 

6. Styling File Inputs with CSS and the DOM
File inputs (<input type=”file” />) are the bane of beautiful form design. No rendering engine provides the granular control over their presentation designers desire. This simple, three-part progressive enhancement provides the markup, CSS, and JavaScript to address the long-standing irritation.

对input区域的美化,简单实用,同时也证明一件事情: 一个好的网页设计要注重每一个细节。

 

 

7. A Savvy Approach to Copyright Messaging
Derek Powazek suggests adding a copyright message to a photo and use CSS to crop its view. This is supposed to accomplish the goal of adding robust copyright information without defacing your own work.

Derek Powazek提出的利用一张图片和CSS结合,为你的风容添加一个强有力的版权声明信息。

 

 

8. Particletree Category List

一个漂亮的树型分类列表

 

 

9. Advanced CSS Menu Trick
What we want to do here, is instead of simply altering the state of the navigation item the user is currently rolling over, we want to alter the non navigation items as well.

高级的CSS菜单创建技巧,你可以学着创建出各种漂亮效果的CSS菜单

 

 

10. CSS hover effect

让所有HTML元素都能像<a>元素那样实现悬浮效果

 

 

11. Creating a table with dynamically highlighted columns like Crazy Egg’s pricing table

创建一个动态亮高的表格,效果非常酷,类似于YOBO音乐播放器的那种效果。

 

 

12. A Stripe of List Style Inspiration
A different type of list and navbar styling. As stripes.

 

 

13. Rediscovering the Button Element

一个个性的CSS列表风格

 

 

14. Dynamic CSS With Variables
Geoffrey Grosenbach describes how you can integrate CSS variables in CSS coding — with Ruby on Rails.

Geoffrey Grosenbach为你讲解如何整合CSS应用到 Ruby on Rails.

 

 

15. Hyperlink Cues with Favicons
I wanted to extend the concept of hyperlink cues a little. For links that point to external sites, what if, instead of showing a generic ‘external link’ icon, we showed that site’s favicon?

为每一外部链接显示一个醒目的图标,来提高链接的点击。

 

 

16. A CSS styled table version 2

又一个CSS风格的表格

 

 

17. CSS Step Menu
A method of designing the so-called step-menus, which have some steps users have to go through in order to achieve some aim. This menu offers a varying amount of steps, dependent upon the type of user accessing the application.

一步一步的设计之旅。而到底有多少要看你想要创建的东西的复杂程度。

 

 

18. Creating bulletproof graphic link buttons with CSS | 456 Berea Street

用CSS创建出超酷效果的点击按钮

 

 

19. Iconize Textlinks with CSS
Links are fun, but sometimes we don’t know where they take us. With this little CSS technique a user can identify a link by its icon. The updated release of the technique.

给网站中不同的文档指定一个不同的图标。

 

 

20. Better Ordered Lists (Using Simple PHP and CSS)
Ordered lists are boring! Sure you can apply background images and do quite a bit of sprucing up to a regular ordered list, but you just don’t get enough control over the number itself.

创建一个有序列表的文章显示效果。

 

 

21. Circular Menu with CSS
This article shows how a beautiful circular navigation menu is created. In Spanish with Source code and an example.

 

 

22. CSS Dock Menu

 

 

23. Digg-like navigation bar using CSS
This tutorial explains how to design a digg-like navigation bar using a liquid design with rounded corners for links.

 

 

24. 13 Awesome Javascript CSS Menus
13 “fresh” JavaScript+CSS-based navigation menus in a brief overview. Among other things Slashdot Menu and Sexy Sliding Menu displayed below.

 

 

25. CSS Pricing Matrix
A CSS-based matrix in which clicking on a highlights the associated cell in the top row and left column giving an indication of relationships among the provided information. Similar solution: Tablecloth.

 

 

26. CSS List Expander
So, we have an unordered list that can go on in depth as much as we want. The script analyzes the list tree and applies toggle functions for expanding/collapsing child objects.

 

 

 

27. How to create VISTA style toolbar with CSS
Reproducing Vista toolbar, with buttons and hover effect in cross-browser compatible CSS and (X)HTML.

 

 

28. Fade Out Bottom
This is a demonstration of the effect where the bottom of the page seems to fade out. The technique makes use of an fixed position div (bottom: 0%) with a transparent PNG image and a high z-index value.

 

 

29. Scrollovers - A New Way of Linking
Everyone is familiar with hover-effects. This CSS+JavaScript-based techniques creates the Scrolleffect - not really necessary, but it’s nice to know, how it can be done.

30. How to Style an A to Z Index with CSS

 

 

31. CSS List Boxes
Using a simple unordered list this experiment aligns the boxes across the page with the end result being to showcase items like services, products, or specials. One of cool thing about this — if you turn off styles — is the extractable semantics with the headings and paragraphs used.

32. How-to create a “Table of Contents” Navigation
In as little as 8 lines of HTML, and 5 lines of CSS, the Table Of Contents Navigation block can be integrated in your site ready for even more styling.

 

 

33. CSS Recipe for Success

 

 

34. Partial Opacity

 

 

35. Simple Round CSS Links (Wii Buttons)

 

 

36. How to make sexy buttons with CSS

 

 

37. CSS Pull Quotes

 

 

38. Drop Shadow CSS

 

 

39. CSS Speech Bubbles
Easy to customize speech bubbles coded in CSS and valid XHTML 1.0 strict.Tested in all major browsers.

 

 

40. CSS Double Lists

 

 

41. Perspective Text with CSS

 

 

42. Better Email Links: Featuring CSS Attribute Selectors
Learn how to generate code for displaying the e-mail automatically once mailto is used. CSS Attribute Selectors in action which is not supported by Internet Explorer 6 and 7.

 

 

43. CSS: Menu Descriptions
This is a CSS technique that could be useful if you want to give users accessible added content such as tool-tips, notifications, or alerts, without adding unnecessary clutter to your page. And since it doesn’t rely of JavaScript, it should be useful to everyone, even disabled users.

 

 

Further Techniques

 

44. CSS Transparency Settings for All Browsers

 

 

45. Time Sensitive CSS Switcher
CSS Switching script that changes style sheet based on time of day.

 

 

46. Custom Reading Containers
This amazing little script allows the user to resize any container.

 

 

47. Eric Meyer’s CSS Reset

 

 

48. PNG Overlay
Create a transparent PNG overlay which can be used as a mask / frame around regular JPEG or GIF so users can upload photos without having to worry about using any graphics program to apply filters, plus it saves time.

 

 

49. Turning Lists into Trees

 

 

50. Create Resizable Images With CSS

附件: 您所在的用户组无法下载或查看附件
Do you know SoCool skin? check here!

IconsBox‘s Blog

TOP

呵呵, 懒人啦,不自己写, 大家都用现成的,那俺们这些做前台的该喝风去了,

TOP

有没有人看了非常头晕,有的单词不认识? 哈哈
看一下http://hi.baidu.com/rtqq/blog/item/0f76010803c4a7d562d98626.html这个相对应的翻译。
[其实如果是学CSS的人,不用看文章, 直接看CSS是怎么写的就行了]
    补充一下:
大概的浏览了一下里面的文章, 其中最后一个可能有的人不明白是在讲什么,告诉大家一个方法应该知道了,打开http://www.smileycat.com/miaow/archives/resize-image.php 也就是第50篇文章的例子,按住CTRL键,同时滚动鼠标的中间滚轴,你就会看到效果了,(第2个图和第3个图的尺寸是随着文字的大小改变还作出相应的变化)。
   题外话:在写CSS的时候 我们的font-size大都用px作为单位,目前中国现在可能90%以上的网站都是用的px,很少的是用em作为字体大小单位的,用em有什么好处呢?就是在IE和FF下都支持CTRL + 鼠标中键来改变文字的大小 以方便自己的阅读。
   PS:1.用px做单位的话IE6是不支持的,至于IE7和IE8就不知道了,相信将来会支持,FF 下em和px都支持该操作。
        2.上面说这些,并不是在说用em就比px好,只是说一个方法而已。因为字体的放大也会给布局带来混乱。同时em的计算也很麻烦。
   想了解em方面的就看一下http://jorux.com/archives/95-web ... eed-to-rewrite-css/  这个文章。

[ 本帖最后由 bjfane 于 2008-4-17 13:10 编辑 ]
本帖最近评分记录
  • iconsbox =饭团= +8 非常感谢做了这么详细的补充! 2008-4-17 14:05

TOP

呵呵,还有中文版的啊~今天发现了这个就赶紧拿转过来了。
非常谢谢bjfane,做的补充。一会儿吧中文的弄过来~呵呵

其实对与很多不熟悉CSS的人看来一样是天书。例如我~~

另外,我觉得,要想真正的用好这些CSS的话,其实还是不容易的~呵呵
Do you know SoCool skin? check here!

IconsBox‘s Blog

TOP

看不到图......................

TOP

全部调整过了,已经可以看到了~呵呵
Do you know SoCool skin? check here!

IconsBox‘s Blog

TOP

很受用。bjfane补充了那么多。。。我还不知道补充点什么了。呵呵
还有就是em可以相对大小。并不是固定的。做自适应大小的网页的时候经常会用到。
而对于png透明。IE7已经支持png透明了。唯独IE6不支持。
可以用js使IE6让png透明。
如果不服在的图片或者背景的话,用css也可以让ie6实现png透明。
关于web前端。路还很长。

TOP

哇噻.都很好很强大的style.收藏了. 还要多多学习啊...

TOP

好帖子,值得去学习

TOP

  ADD FAV ...
http://www.rooyu.com

TOP

css强

用代码做设计也是一种途径,值得学习!!

TOP

后面的都难得写了。。。。。。。。。。。。。。。。。。。。。。。。。。

TOP

厉害啊,收下了,谢谢哈

TOP

coool
收藏鸟。谢谢lz的分享。

TOP

这些都是高级的东东啊。呵呵。

TOP

发新话题