1.HTML5基础

文档类型

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> Transitional:过渡类型 Strict:严格类型 FrameSet:框架类型

<!DOCTYPE html>

使用video和audio标签播放视频和音频

 <video controls>
<source src="video/video.webm" type="video/webm"/>
<source src="video/video.mp4" type="video/mp4"/>
</video>

2.弹性盒子

box-sizing:border-box/content-box(默认值)

3.圆角边框

Border-raduis:左上角,右上角,右下角,左下角。

CSS 其语法的日新月异,让很多以前完成不了的事情,现在可以非常轻松的做到。说几个比较新的强大的 CSS 功能:

  • clip-path
  • shape-outside

shape 的意思是图形,CSS shapes 也就是 CSS 图形的意思,也就是使用 CSS 生成各种图形(圆形、矩形、椭圆、多边形等几何图形)。

CSS3之前,我们能做的只有矩形,四四方方,条条框框。

CSS3

CSS3出来后,我们有了更广阔的施展空间,通过

  • border-radius
  • border
  • transform
  • 伪元素配合
  • gradient 渐变

我们能够作出非常多的几何图形。

除去最常见的矩形,圆形(border-radius),下面稍微列举一些其他几何图形:

//01圆角边的css
#circle{
width: 300px;
height: 300px;
border: 1px solid red;
border-radius: 10px;
box-shadow: 5px 5px 5px green;
}
<div id="circle">我是圆角边的div</div>
//02圆形的css加图片
#circleshape{
width: 300px;
height: 300px;
border: 1px solid red;
border-radius: 150px;
background: url("img/001.jpg") 0px 0px no-repeat;
background-size: cover;
opacity: 0.7;
transition: all 5s;
}
#circleshape:hover{
transform: rotate(300deg) scale(1.5);
transition: all 5s linear;
}
<div id="circleshape">我是圆形的div</div> //03半圆形的CSS
#halfcircle{
width: 300px;
height: 150px;
border: 1px solid red;
border-radius: 150px 150px 0px 0px;
background:linear-gradient(to top,pink,palegreen);
background:radial-gradient(palegoldenrod,palevioletred);
}
<div id="halfcircle">我是半圆形的div</div> //04四分之一圆形
#halfcircles{
width: 150px;
height: 150px;
border: 1px solid red;
border-radius: 150px 0px 0px 0px;
}
<div id="halfcircles">我是四分之一圆形的div</div> #halfcircless{
width: 150px;
height: 150px;
border: 1px solid red;
border-radius: 0px 150px 0px 0px;
}
<div id="halfcircless">我是四分之一圆形的div</div> #halfcirclesss{
width: 150px;
height: 150px;
border: 1px solid red;
border-radius: 0px 0px 0px 150px;
}
<div id="halfcirclesss">我是四分之一圆形的div</div> #halfcirclessss{
width: 150px;
height: 150px;
border: 1px solid red;
border-radius: 0px 0px 150px 0px;
}
<div id="halfcirclessss">我是四分之一圆形的div</div> #halfcircl{
width: 300px;
height: 150px;
border: 1px solid red;
border-radius: 0px 0px 150px 150px;
}
<div id="halfcircl">我是半圆形的div</div> //05:三角形
.traingle {
width: ;
height: ;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid yellowgreen;
} <div class="traingle ">
我的三角形,我是div
</div> //06:切角:多重线性渐变实现切角。
.notching {
width: 40px;
height: 40px;
padding: 40px;
background: linear-gradient(135deg, transparent 15px, yellowgreen ) top left,
linear-gradient(-135deg, transparent 15px, yellowgreen ) top right,
linear-gradient(-45deg, transparent 15px, yellowgreen ) bottom right,
linear-gradient(45deg, transparent 15px, yellowgreen ) bottom left;
background-size: % %;
background-repeat: no-repeat; } <div class="notching">
我是切角,我是div
</div> //07:椭圆形
.ellipse {
width: 120px;
height: 160px;
background-color: yellowgreen;
border-radius: % % % % / % % % %;
}
<div class="ellipse">
我是椭圆形,我是div
</div> :梯形:伪元素加旋转透视实现梯形
.trapezoid{ position: relative; width: 60px; padding: 60px; } .trapezoid::before{ content:""; position: absolute; top: ; right: ; bottom: ; left: ; transform: perspective(20px) scaleY(1.3) rotateX(5deg); transform-origin: bottom; background: yellowgreen; } <div class="trapezoid">
我是上面短的梯形,我是div
</div> .trapezoids { position: relative; width: 60px; border-top: 60px solid yellowgreen; border-left: 40px solid transparent; border-right: 40px solid transparent; }
<div class="trapezoids">
我是下面短的梯形,我是div
</div> //09.五边形:梯形加上三角形,很容易就组合成一个五边形,这里需要借助一个伪元素实现: .pentagon { position: relative; width: 60px; border-bottom: 60px solid yellowgreen; border-left: 40px solid transparent; border-right: 40px solid transparent; }
.pentagon::before { content:""; position: absolute; top: 60px; left: -40px; border-top: 60px solid yellowgreen; border-left: 70px solid transparent; border-right: 70px solid transparent; } //10六边形 看看上面的梯形,如果两个反方向且底边同样大小的梯形,叠加在一起,是不是就能得到一个六边形呢 .pentagon { position: relative; width: 60px; border-bottom: 60px solid yellowgreen; border-left: 40px solid transparent; border-right: 40px solid transparent; } .pentagon::before { content: ""; position: absolute; width: 60px; height: 0px; top: 60px; left: -40px; border-top: 60px solid yellowgreen; border-left: 40px solid transparent; border-right: 40px solid transparent; } //11:八边形 六边形都解决了,八边形也不在话下,一个矩形加上两个梯形,可以合成一个八边形。 .octagon { position: relative; width: 40px; height: 100px; background: yellowgreen; } .octagon::before { content: ""; height: 60px; position: absolute; top: ; left: 40px; border-left: 30px solid yellowgreen; border-top: 20px solid transparent; border-bottom: 20px solid transparent; } .octagon::after { content: ""; height: 60px; position: absolute; top: ; left: -30px; border-right: 30px solid yellowgreen; border-top: 20px solid transparent; border-bottom: 20px solid transparent; }
//12:五角星 好的,探索完多边形,我们继续探索X角星。 先来看看五角星,要怎么实现呢?当然是直接打出来啦 -- ★☆ .star { margin: 50px ; position: relative; width: ; border-right: 100px solid transparent; border-bottom: 70px solid yellowgreen; border-left: 100px solid transparent; transform: rotate(35deg) scale(.); } .star:before { content: ''; position: absolute; border-bottom: 80px solid yellowgreen; border-left: 30px solid transparent; border-right: 30px solid transparent; top: -45px; left: -65px; transform: rotate(-35deg); } .star:after { content: ''; position: absolute; top: 3px; left: -105px; border-right: 100px solid transparent; border-bottom: 70px solid yellowgreen; border-left: 100px solid transparent; transform: rotate(-70deg); } //12:六角星 六角星呢?想象一下,一个向上的三角形 ▲,叠加上一个向下的三角形 ▼,就可以得到一个六边形: .sixstar { position: relative; width: ; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 100px solid yellowgreen; } .sixstar:after { content: ""; position: absolute; border-left: 50px solid transparent; border-right: 50px solid transparent; border-top: 100px solid yellowgreen; top: 30px; left: -50px; }
//13:八角星 八角星呢?八个角那么多呢。其实使用两个矩形进行旋转拼接就可以了。 .eightstar { position: relative; width: 100px; height: 100px; background-color: yellowgreen; transform: rotate(30deg); } .eightstar::before { content: ""; position: absolute; top: ; left: ; width: 100px; height: 100px; transform: rotate(45deg); background-color: yellowgreen; }
//14:十二角星 好。最后多角星再来一个十二级角星。在八角星的基础上,再增加一个矩形,就能得到十二角啦。也就是要过第一个伪元素。 .twelvestar { position: relative; width: 100px; height: 100px; margin-bottom: 100px!important; background-color: yellowgreen; transform: rotate(30deg); } .twelvestar::before { content: ""; position: absolute; top: ; left: ; width: 100px; height: 100px; transform: rotate(30deg); background-color: yellowgreen; } .twelvestar::after { content: ""; position: absolute; top: ; left: ; width: 100px; height: 100px; transform: rotate(60deg); background-color: yellowgreen; }

美丽的CSS图形和HTML5的更多相关文章

  1. 奇妙的 CSS shapes(CSS图形)

    CSS 发展到今天已经越来越强大了.其语法的日新月异,让很多以前完成不了的事情,现在可以非常轻松的做到.今天就向大家介绍几个比较新的强大的 CSS 功能: clip-path shape-outsid ...

  2. css图形——三角形

    1.css图形简介 在浏览网页的时候,我们经常看见各种图形的效果,而但凡涉及到图形效果,我们第一个想到的就是用图片来实现.但是在前端开发中,为了网站的性能速度,我们都是秉承着少用图片的原生质. 因为图 ...

  3. 奇妙的 CSS shapes(CSS图形) 【css 图形,绘图,CSS 几何图形)】

    http://www.cnblogs.com/coco1s/p/6992177.html <!DOCTYPE html> <html> <head> <met ...

  4. 有趣的css图形实现

    css通过 border .border-radius .transform,实现各种图形. <!DOCTYPE html> <html lang="en"> ...

  5. CSS图形基础:纯CSS绘制图形

    为了在页面中利用CSS3绘制图形,在页面中定义 <div  class="container"> <div class="shape"> ...

  6. 利用噪声构建美妙的 CSS 图形

    在平时,我非常喜欢利用 CSS 去构建一些有意思的图形. 我们首先来看一个简单的例子.首先,假设我们实现一个 10x10 的格子: 此时,我们可以利用一些随机效果,优化这个图案.譬如,我们给它随机添加 ...

  7. CSS图形形状大全

    The Shapes of CSS All of the below use only a single HTML element. Any kind of CSS goes, as long as ...

  8. CSS图形

    1.正方形 最终效果:   CSS代码如下: #square { width: 100px; height: 100px; background: red; }    2.长方形 最终效果:   CS ...

  9. css图形——椭圆

    在css中,我们也使用border-radius属性来实现椭圆 语法 border-radius:x/y; 说明: x表示圆角的水平半径,y表示圆角的垂直半径. 例如:border-radius:30 ...

随机推荐

  1. Spring+SpringMVC+MyBatis+easyUI整合优化篇(十二)数据层优化-explain关键字及慢sql优化

    本文提要 从编码角度来优化数据层的话,我首先会去查一下项目中运行的sql语句,定位到瓶颈是否出现在这里,首先去优化sql语句,而慢sql就是其中的主要优化对象,对于慢sql,顾名思义就是花费较多执行时 ...

  2. linux基础 作业篇

    1.自动部署反向代理 web nfs #!/usr/bin/python #-*- coding:utf-8 -*- #开发脚本自动部署及监控 #1.编写脚本自动部署反向代理.web.nfs: #!/ ...

  3. easyui datebox定位到某一个日期, easyui datebox直接定位到具体的日期, easyui datebox MoveTo方法使用

    easyui datebox定位到某一个日期, easyui datebox直接定位到具体的日期, easyui datebox MoveTo方法使用 >>>>>> ...

  4. windows10 配置 华为vpn客户端

    2017-05-08 1. 安装客户端软件VPNClient_V100R001C02SPC703.exe 2. 新建vpn 安装完成后,打开客户端连接vpn,发现未启用虚拟网卡(这是因为还需要安装客户 ...

  5. __call()和__callStatic()实例详解

    <?php class Demo { //第一个参数是方法名,第二个参数是方法参数,以数组形式传入 public function __call($method,$args) { //遍历参数$ ...

  6. PHP获得上(两)周时间

    就不手写了

  7. vs项目和msql不兼容解决方案

    当vs的工程项目加载了libmysql.lib 即:附加包含目录,附加库目录,附加依赖项都设置好之后,如过编译出现如下: error LNK2019: 无法解析的外部符号 _mysql_real_co ...

  8. 将sublimeText添加到鼠标右键菜单栏

    将sublimeText添加到鼠标右键菜单栏主要是写一个注册表的文件,将这个注进去,首先你需要清楚你的sublimeText软件的安装路径,然后改一下下面这段代码就可以了 Windows Regist ...

  9. 【WPF】学习笔记(三)——这个家伙跟电子签名板有个约定

    这篇博客依旧是以电子签名板为基础而展开的,主要是对前文([WPF]学习笔记(一)--做一个简单的电子签名板)存在的部分问题进行解释,以及部分小功能的添加.由于这篇博客是建立在学习笔记一的基础上的,所以 ...

  10. synchronized 修饰在 static方法和非static方法的区别

    Java中synchronized用在静态方法和非静态方法上面的区别 在Java中,synchronized是用来表示同步的,我们可以synchronized来修饰一个方法.也可以synchroniz ...