css好用吗,比较好用的 CSS 的技巧,总有一个你需要的!

原标题:比较好用的 CSS 的技巧,总有一个你需要的!

一、黑白图像

当你需要让一张彩色的图片显示为黑白照片的时候,你可以用下面的一段代码。

626098317bf14629239f771c19f8f4f8.png

二、使用 :not() 在菜单上应用/取消应用边框

253721199b1430046052c9ca102726e5.png

三、页面顶部阴影

给网页加上漂亮的顶部阴影效果

017d4d6da2062fd1a30b82db28aafddc.png

四、给 body 添加行高

不需要给别给 p,h之类的添加行高,直接:

body{ line-height: 1;}

五、所有一切都垂直居中

512f4928b9d9d60e17e2e8dcaa606e67.png

IE11中需要注意 flexbox

六、逗号分隔列表

让HTML列表项看上去像被一个真正的,分隔的列表

ul > li:not(:last-child)::after{ content: ","; }

七、使用负的 nth-child 选择项目

在 css 中使用负的 nth-child 选择项目1到项目n

23d73697272d12d0a66a3a32c0fa9c23.png

八、对图标使用 SVG

.logo{ background: url("logo.svg"); }

九、优化显示文本

有时候,字体并不能在所有设备上都达到最佳的显示,所以可以让设备浏览器来帮助你

2af9a9286769c99062b995cc45c6af15.png

十、对纯 css 滑块使用 max-height

使用 max-height 和溢出隐藏来实现只有 css 的滑块

责任编辑:

好用CSS,960 Grid System Version 1.5 2010-05-11 Created by Nathan Smith. See the official site for more info: http://960.gs/ ============================================================================ Thank you for downloading the 960 Grid System. I hope it helps to streamline web development workflow. Enclosed in the bundle are printable sketch sheets and template files for Adobe Fireworks and Photoshop, OmniGraffle and Visio. Also included is a lightweight CSS file, which contains the grid dimensions. To use this file, simply include the 960.css in the <head> of the HTML page. You may also use the reset.css and text.css files, or opt to leave them out. Here is an example of the XHTML code necessary to incorporate the CSS files: <head> <link rel="stylesheet" type="text/css" media="all" href="css/reset.css" /> <link rel="stylesheet" type="text/css" media="all" href="css/text.css" /> <link rel="stylesheet" type="text/css" media="all" href="css/960.css" /> </head> It is worth noting that these styles do not automatically make up a finished site design. They are simply a starting point, ideally for rapid prototyping or as a basis for creating your own designs. You should not feel constrained by the way I have built the initial code. If you disagree with how something has been done, feel free to revise it for the needs of your particular site. The files in the 960 Grid System are free of charge, licensed under GPL/MIT. ============================================================================ Note that if you are building a site in a language which reads from right to left, use the CSS files that begin with "rtl_" instead. Denote the language: <html lang="..." dir="rtl"> Be sure to replace "..." with the appropriate two-letter abbreviation of the language you are using. Example: lang="he" for Hebrew, lang="ar" for Arabic. ============================================================================ Special thanks to Eric Meyer for his comprehensive browser reset stylesheet. http://meyerweb.com/eric/tools/css/reset/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值