一、前言

不得不说css真强大,总结了几个常用的css特殊效果

二、主要内容

1、几个特殊效果

$green = #02a774;
$yellow = #F5A100;
$bc = #e4e4e4; // 一像素下边框
bottom-border-1px($color)
position relative
border none
&:after
content ''
position absolute
left 0
bottom 0
width 100%
height 1px
background-color $color
transform scaleY(0.5) // 一像素上边框
top-border-1px($color)
position relative
&::before
content ''
position absolute
z-index 200
left 0
top 0
width 100%
height 1px
background-color $color //根据像素比缩放1px 像素边框
@media only screen and (-webkit-device-pixel-ratio: 2 )
.border-1px
&::before
transform scaleY(.5)
@media only screen and (-webkit-device-pixel-ratio: 3 )
.border-1px
&::before
transform scaleY(.333333)
//根据像素比来使用2x 图3x 图
bg-image($url)
background-image: url($url + "@2x.png")
@media (-webkit-min-device-pixel-ratio: 3),(min-device-pixel-ratio: 3)
background-image: url($url + "@3x.png") //清除浮动
clearFix()
*zoom 1
&::after
content ''
display block
clear both

2、使用2x 3x图做五星

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
.star.star-24 .star-item {
width: 10px;
height: 10px;
margin-right: 3px;
background-size: 10px 10px;
}
.star.star-24 .star-item:last-child {
margin-right: 0;
}
.star.star-24 .star-item.on {
background-image: url("../images/stars/star24_on@2x.png");
}
@media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
.star.star-24 .star-item.on {
background-image: url("../images/stars/star24_on@3x.png");
}
}
.star.star-24 .star-item.half {
background-image: url("../images/stars/star24_half@2x.png");
}
@media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
.star.star-24 .star-item.half {
background-image: url("../images/stars/star24_half@3x.png");
}
}
.star.star-24 .star-item.off {
background-image: url("../images/stars/star24_off@2x.png");
}
@media (-webkit-min-device-pixel-ratio: 3), (min-device-pixel-ratio: 3) {
.star.star-24 .star-item.off {
background-image: url("../images/stars/star24_off@3x.png");
}
}
span{
display: inline-block;
}
</style>
</head>
<body>
<div class="star star-24">
<span class="star-item on"></span>
<span class="star-item on"></span>
<span class="star-item on"></span>
<span class="star-item half"></span>
<span class="star-item off"></span>
</div>
</body>
</html>

Css(常用的特殊效果)的更多相关文章

  1. css常用样式属性详细介绍

    对于初学css的来说,肯定会觉得这么多样式不好记,而且记住了也容易忘,其实刚开始我们不用去记这么多的样式,确实是记了也会忘,刚开始只需记住一些常用的就可以了,然后在慢慢的使用过程当中接触并学习一些高级 ...

  2. css常用hack

    原文地址:css常用hack 突然想起今天早上在CNZZ看到的统计数据,使用IE6.7的用户比例还真多,看到之后我的心都碎了.微软都放弃了为毛还有这么多人不死心? 所以说,IE下的兼容还是得做的. – ...

  3. CSS常用样式及示例

    CSS常用样式及示例 一.简介      层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集) ...

  4. CSS常用选择器名

    一.页面结构划分 box 盒子wrap 包裹container 容器 header 头部main 主要区域footer 底部 content 内容区域banner 横幅广告区域menu 菜单 二.模块 ...

  5. CSS常用标签

    CSS常用标签 一 CSS文字属性 color : #999999; /*文字颜色*/ font-family : 宋体,sans-serif; /*文字字体*/ font-size : 9pt; / ...

  6. CSS常用样式(四)之animation

    上篇CSS常用样式(三)这篇博文中已经介绍过了CSS中具有动画效果的transition.transform,今天来大概说说CSS中的animation.animation的加入会使得动画效果更加乐观 ...

  7. DIV+CSS常用网页布局技巧!

    以下是我整理的DIV+CSS常用网页布局技巧,仅供学习与参考! 第一种布局:左边固定宽度,右边自适应宽度 HTML Markup <div id="left">Left ...

  8. CSS常用选择器

    关于CSS常用选择器: 1.ID选择器 关于ID选择器具有唯一性,在文档流中,ID是唯一的,在低版本的浏览器中,允许出现不适唯一ID的情况,而在高版本的浏览器中,出现ID不唯一的情况浏览器会出现的报错 ...

  9. css常用文本属性

    [CSS常用文本属性] 1. 字体.字号类: ① font-weight: 字体粗细. bold-加粗.normal-正常.lighter-细体 也可以使用100-900数值,400表示normal, ...

随机推荐

  1. SpringAOP术语

    2019-03-10/21:12:31 参考博客:MiroKlose AOP术语 1.通知: 通知定义了切面要完成的工作内容和何时完成工作,就是什么时候去做辅助功能,功能具体是什么代码 五种类型 Be ...

  2. Dynamics 365中极特殊语言的文字搜索结果异常

    微软动态CRM专家罗勇 ,回复316或者20190314可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me!我的网站是 www.luoyong.me . 有些比较少见的问题, ...

  3. deepin linux学习笔记

    目录 deepin linux学习笔记 前言 linux常用命令 ls 显示文件夹内容 cd 切换当前目录 pwd 查看当前工作目录 mkdir 新建文件夹 rm 删除文件或文件夹 mv 移动文件 c ...

  4. OSXFUSE file system is not available 解决方法

    操作系统版本:10.14 macos mojeva 今天用truecrypt加载加密盘时候提示次错误:用window加载也有错误,不过用windows自带的工具检查修复了错误. 解决办法: 1.访问h ...

  5. ubunru18.04下面安装docker

    sudo apt-get updat // 更新apt包索引 sudo apt-get remove docker docker-engine docker-ce docker.io // 卸载旧版本 ...

  6. windows环境中JDK环境变量配置

    一.环境准备 Windows10 jdk-9.0.1 二.下载并安装JDK 到Java的官网下载JDK安装包,地址:http://www.oracle.com/technetwork/java/jav ...

  7. QTableWidget class

    Help on class QTableWidget in module PyQt5.QtWidgets: class QTableWidget(QTableView)  |  QTableWidge ...

  8. [Bilingual] Different proofs of Jordan cardinal form (Jordan标准型的几种证明)

  9. 类Date

    概述: java.util.Date类 表示特定的瞬间,精确到毫秒.毫秒就是千分之一秒.继续查阅API,发现Date拥有多个构造函数,只是部分已经过时,但是其中有未过时的构造函数可以把毫秒值转成日期对 ...

  10. Android Studio自定义注释模板

    一.自定义新建文件时生成的注释 setting->Editor->File and Code Templates->Includes->File Header,在这里输入自定义 ...