Table of Contents
loading加载效果
box-shadow 属性
具有动感的loading动画效果
winphone loading
animation属性
border-radius属性
flex弹性盒模型
响应式布局Media Queries
具有动感的下拉选择框
总结
具有动感的复选框
before和after属性
css3图片缩放
Home Web Front-end HTML Tutorial CSS3 案例研究与学习_html/css_WEB-ITnose

CSS3 案例研究与学习_html/css_WEB-ITnose

Jun 21, 2016 am 09:03 AM

loading加载效果

效果如下所示,点击预览:

http://codepen.io/hawx1993/pen/YyYVpX

box-shadow 属性

box-shadow: 投影方式,X轴偏移量,Y轴偏移量,阴影模糊半径,阴影扩展半径,阴影颜色;

box-shadow可以多层阴影同时使用,每层阴影之间用逗号隔开。最先写的阴影将显示在最顶层

box-shadow:    -10px 0 10px red, /*X轴为负,阴影在左边*/    10px 0 10px yellow, /*右边阴影*/    0 -10px 10px blue, /*Y轴为负,阴影在顶部*/    0 10px 10px green; /*底边阴影*/    //分割线  -webkit-box-shadow: 1px 4px 4px rgba(0,0,0,0.2),/* 外阴影*/  1px 2px 30px rgba(0,0,0,0.2) inset;/*内阴影*/
Copy after login

具有动感的loading动画效果

效果如下所示,点击预览:

http://codepen.io/hawx1993/pen/wKRPmN

winphone loading

http://codepen.io/hawx1993/pen/yYRzZB

animation属性

animation: name duration timing-function delay iteration-count direction fill-mode  play-state ;
Copy after login

参数依次为:

动画名称,动画持续时间,动画过渡类型,动画延迟时间,动画的循环次数,动画在循环中是否反向运动, 动画时间之外的状态 , 动画的状态

timing-function取值如下

linear:线性过渡。等同于贝塞尔曲线(0.0, 0.0, 1.0, 1.0)
ease:平滑过渡。等同于贝塞尔曲线(0.25, 0.1, 0.25, 1.0)
ease-in:由慢到快。等同于贝塞尔曲线(0.42, 0, 1.0, 1.0)
ease-out:由快到慢。等同于贝塞尔曲线(0, 0, 0.58, 1.0)
ease-in-out:由慢到快再到慢。等同于贝塞尔曲线(0.42, 0, 0.58, 1.0)

direction取值如下:

normal:正常方向
reverse:反方向运行
alternate:动画先正常运行再反方向运行,并持续交替运行
alternate-reverse:动画先反运行再正方向运行,并持续交替运行

fill-mode的取值如下

none:默认值。不设置对象动画之外的状态
forwards:设置对象状态为动画结束时的状态
backwards:设置对象状态为动画开始时的状态
both:设置对象状态为动画结束或开始的状态

play-state: 运动 | 暂停

animation-play-state = running | paused
Copy after login

border-radius属性

border-radius:如果"/"反斜杠符存在,"/"前面的值是设置元素圆角的水平方向半径,"/"后面的值是设置元素圆角的垂直方向的半径;

另外四个值是按照top-left、top-right、bottom-right、bottom-left顺序来设置的。

  • border-radius:设置三个值,第一个值设置top-left,第二个值设置top-right和bottom-left,第三个值设置bottom-right

  • border-radius:设置两个值,top-left等于 bottom-right,并且取第一个值;top-right等于bottom-left,并且取第二个值

  • border-radius:水平半径 / 垂直半径(60px 40px 30px 20px)/ (30px 20px 10px 5px):每个数值分别为上右下左的方向值

border-radius: 左上角水平圆角半径大小,右上角水平圆角半径大小 ,右下角水平圆角半径大小 ,左下角水平圆角半径大小 / 左上角垂直圆角半径大小 ,右上角垂直圆角半径大小 ,右下角垂直圆角半径大小 ,左下角垂直圆角半径大小;

border-radius:300px ===border-radius: 300px 300px 300px 300px/300px 300px 300px 300px;
Copy after login

flex弹性盒模型

响应式DEMO:

http://codepen.io/hawx1993/pen/KdrVrZ

伸缩性flex

flex:none | <' flex-grow '> <' flex-shrink >'? || <' flex-basis '>
Copy after login


flex-grow:扩展比例:默认值1flex-shrink:收缩比例:默认值1flex-basis:伸缩基准值。`「flex子项」`长度的起始数值。如果缩写「flex: 1」, 则其计算值为「1 1 0%」如果缩写「flex: auto」, 则其计算值为「1 1 auto」如果「flex: none」, 则其计算值为「0 0 auto」
Copy after login

flex-flow 定义了伸缩容器的主轴和侧轴

flex-flow:<' flex-direction '> || <' flex-wrap '>
Copy after login

<' flex-direction '>: 定义弹性盒子元素的排列方向。row、row-reverse、column、column-reverse
<' flex-wrap '>: 控制flex容器是单行或者多行。
默认值:row nowrap

flex-wrap 定义伸缩容器里是单行还是多行显示

flex-wrap:nowrap | wrap | wrap-reverse
Copy after login

nowrap:flex容器为单行。该情况下flex子项可能会溢出容器
wrap:flex容器为多行。该情况下flex子项溢出的部分会被放置到新行,子项内部会发生断行
wrap-reverse:反转 wrap 排列。

flex-direction 决定伸缩布局主轴的方向

  • row:伸缩项目按照他们在文档流中出现的顺序进行显示

  • row-reverse:如果书写模式是ltr,伸缩项目从右向左排列

  • column:按照文档流从上到下排列

  • column:伸缩项目从下到上排列

/* flex-flow: <'flex-direction'> */flex-flow: row;flex-flow: row-reverse;flex-flow: column;flex-flow: column-reverse;/* flex-flow: <'flex-wrap'> */flex-flow: nowrap;flex-flow: wrap;flex-flow: wrap-reverse;/* flex-flow: <'flex-direction'> and <'flex-wrap'> */flex-flow: row nowrap;flex-flow: column wrap;flex-flow: column-reverse wrap-reverse;/* Global values */flex-flow: inherit;flex-flow: initial;flex-flow: unset;
Copy after login

响应式布局Media Queries

类型 解释
@meida all and (min-width:800px) 所有最小水平屏幕宽度为800像素的屏幕应用规则
@meida and (min-width:800px) 简写方式,同上
@media (not min-width:800px) 当最小宽度不是800像素时会应用下列CSS规则


具有动感的下拉选择框

效果如下所示:

http://codepen.io/hawx1993/pen/rOoGpP

transform-origin

设置旋转元素的基点位置:

transform-origin: x-axis y-axis z-axis;
Copy after login

transform:rotate()

角度值为正,则顺时针旋转,反之则逆时针旋转

总结

指定x轴,y轴的值的属性有translate()、scale():

  • translate(x,y)

  • translate3d(x,y,z)

  • translateX(x)

  • translateY(y)

  • scale(x,y)

  • scaleX(number)

  • scaleY(number)

translate3d(tx,ty,tz):

  • tx:代表横向坐标位移向量的长度

  • tz: 代表z轴位移向量的长度。此值不能是一个百分比值,如果取百分比将会认为是无效

指定角度的属性有rotate()和skew():

  • rotate(angle)

  • rotateX(angle)

  • rotateY(angle)

  • rotateZ(angle)

rotateX(a) 函数功能等同于rotate3d(1,0,0,a)
rotate3d(x,y,z,a):x,y,z取0~1的数值,用来描述元素围绕X/Y/Z轴旋转的矢量值。

  • skewX(angle)

  • skewY(angle)

  • skew(x-angle,y-angle)

具有动感的复选框

http://codepen.io/hawx1993/pen/vNvWgW

before和after属性

:before是在元素的内容之前插入或创建一个虚拟的元素,:after是在元素的内容之后插入或创建一个虚拟的元素 (这相当于插入一个first-child和last-child属性)

css3图片缩放

效果如下所示,点击预览:

http://codepen.io/hawx1993/pen/zvyjEp

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1664
14
PHP Tutorial
1266
29
C# Tutorial
1239
24
Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

HTML, CSS, and JavaScript: Essential Tools for Web Developers HTML, CSS, and JavaScript: Essential Tools for Web Developers Apr 09, 2025 am 12:12 AM

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

HTML: The Structure, CSS: The Style, JavaScript: The Behavior HTML: The Structure, CSS: The Style, JavaScript: The Behavior Apr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML, CSS, and JavaScript: Web Development Trends The Future of HTML, CSS, and JavaScript: Web Development Trends Apr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The Future of HTML: Evolution and Trends in Web Design The Future of HTML: Evolution and Trends in Web Design Apr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative Overview HTML vs. CSS vs. JavaScript: A Comparative Overview Apr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Building the Structure of Web Pages HTML: Building the Structure of Web Pages Apr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

The Role of HTML: Structuring Web Content The Role of HTML: Structuring Web Content Apr 11, 2025 am 12:12 AM

The role of HTML is to define the structure and content of a web page through tags and attributes. 1. HTML organizes content through tags such as , making it easy to read and understand. 2. Use semantic tags such as, etc. to enhance accessibility and SEO. 3. Optimizing HTML code can improve web page loading speed and user experience.

See all articles