Css(常用的特殊效果)
一、前言
不得不说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(常用的特殊效果)的更多相关文章
- css常用样式属性详细介绍
对于初学css的来说,肯定会觉得这么多样式不好记,而且记住了也容易忘,其实刚开始我们不用去记这么多的样式,确实是记了也会忘,刚开始只需记住一些常用的就可以了,然后在慢慢的使用过程当中接触并学习一些高级 ...
- css常用hack
原文地址:css常用hack 突然想起今天早上在CNZZ看到的统计数据,使用IE6.7的用户比例还真多,看到之后我的心都碎了.微软都放弃了为毛还有这么多人不死心? 所以说,IE下的兼容还是得做的. – ...
- CSS常用样式及示例
CSS常用样式及示例 一.简介 层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集) ...
- CSS常用选择器名
一.页面结构划分 box 盒子wrap 包裹container 容器 header 头部main 主要区域footer 底部 content 内容区域banner 横幅广告区域menu 菜单 二.模块 ...
- CSS常用标签
CSS常用标签 一 CSS文字属性 color : #999999; /*文字颜色*/ font-family : 宋体,sans-serif; /*文字字体*/ font-size : 9pt; / ...
- CSS常用样式(四)之animation
上篇CSS常用样式(三)这篇博文中已经介绍过了CSS中具有动画效果的transition.transform,今天来大概说说CSS中的animation.animation的加入会使得动画效果更加乐观 ...
- DIV+CSS常用网页布局技巧!
以下是我整理的DIV+CSS常用网页布局技巧,仅供学习与参考! 第一种布局:左边固定宽度,右边自适应宽度 HTML Markup <div id="left">Left ...
- CSS常用选择器
关于CSS常用选择器: 1.ID选择器 关于ID选择器具有唯一性,在文档流中,ID是唯一的,在低版本的浏览器中,允许出现不适唯一ID的情况,而在高版本的浏览器中,出现ID不唯一的情况浏览器会出现的报错 ...
- css常用文本属性
[CSS常用文本属性] 1. 字体.字号类: ① font-weight: 字体粗细. bold-加粗.normal-正常.lighter-细体 也可以使用100-900数值,400表示normal, ...
随机推荐
- informix存储过程笔记
一.存储过程概述 存储过程是一个用户定义的函数,由存储过程语句(SPL) 和一组SQL语句组成,以可以执行代码形式存储在数据库中,和表.视图.索引等一样,是数据库的一种对象. 存储过程语言SPL(St ...
- python 练习 后台返回当前时间
新建一个 current_time.html 文件, !cur_time! 用来替换 <!DOCTYPE html> <html lang="en"> &l ...
- mysqli_fetch_array() ,mysqli_fetch_assoc()遇到的问题
该函数每运行一次就会读取一行数据. $book1_imgnum="select * from book_img limit 12"; $book1_totalimg=mysqli_ ...
- ButterKnife的使用详解
ButterKnife的使用详解 1,概述: ButterKnife则是注解中相对简单易懂的很不错的开源框架. ButterKnife是目前常用的一种依托Java注解机制实现辅助代码生成的框架:用到了 ...
- Spark RPC框架源码分析(一)简述
Spark RPC系列: Spark RPC框架源码分析(一)运行时序 Spark RPC框架源码分析(二)运行时序 Spark RPC框架源码分析(三)运行时序 一. Spark rpc框架概述 S ...
- 简单概括下MongoDB 4.0 新特性
(1)跨文档事务支持 (ACID) 首个支持跨文档事务的NoSQL云数据库,将文档模型的速度,灵活性和功能与ACID保证相结合.现在,使用MongoDB解决各种用例变得更加容易. (2)40%迁移速度 ...
- 如何从GitHub下载csv文件
当打开存.csv文件的页面时,不用直接点击页面的Download,这样会使csv文件直接用浏览器打开. 要点击Raw按钮,鼠标右键,文件另存为,可以直接把csv文件下载到本地.
- Jenkins 使用Tfs 插件出现 MappingConflictException 错误问题解决
FATAL: com.microsoft.tfs.core.clients.versioncontrol.exceptions.MappingConflictException: The path C ...
- kvm虚拟机管理基础
部署 KVM 虚拟机 a.kvm 安装 环境:centos7,cpu 支持虚拟化,关闭 selinux,关闭 firewalld yum install libvirt virt-install qe ...
- k8s部署dashboard:v1.5.1
1.准备dashboard.yaml文件 apiVersion: extensions/v1beta1 kind: Deployment metadata: # Keep the name in sy ...