热门标签 | HotTags
当前位置:  开发笔记 > 前端 > 正文

css3常见新特性介绍

css3常见新特性:1、增加了新的元素选择器,如【E:nth-last-child(n),E:nth-of-type(n)】;2、border-radius属性,该属性可以将图片圆角化;3、增加了background-clip属性。

新的元素选择器

E:nth-last-child(n), E:nth-of-type(n), E:nth-last-of-type(n), E:last-child, E:first-of-type, E:only-child, E:only-of-type, E:empty, E:checked, E:enabled, E:disabled, E::selection, E:not(s)

border-radius

又称圆角属性,通常使用该属性将图片圆角化,如头像。

border-radius: 50%;

border-radius另外一个常用的手段是CSS动画。

word-wrap & text-overflow

word-wrap属性用来指出浏览器在单词内进行断句,防止字符串太长而找不到它的自然断句点时产生的溢出。

word-wrap: break-word;

text-overflow用于文本溢出:

单行缩略的实现如下:

.oneline {
    white-space: nowrap; //强制文本在一行内输出
    overflow: hidden; //隐藏溢出部分
    text-overflow: ellipsis; //对溢出部分加上...
}

多行缩略实现如下(主要针对webkit内核):

.multiline {
    display: -webkit-box !important;
    overflow: hidden;
    
    text-overflow: ellipsis;
    word-break: break-all;
    
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

background

主要是以下三个属性:

  • background-clip 规定背景的绘制区域, 取值为border-box | padding-box | content-box | no-clip

  • background-origin 规定背景的定位区域, 取值为border | padding | content

  • background-size 规定背景图片的尺寸, 取值为[ | | auto]{1,2} | cover | contain

推荐教程:css快速入门

以上就是css3常见新特性介绍的详细内容,更多请关注其它相关文章!


推荐阅读
author-avatar
高--洁
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有