• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com专业计算机教程网站
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure
您的位置:首页 > 网页设计 >html5 > CSS+HTML5的使用方法实例

CSS+HTML5的使用方法实例

作者:匿名 字体:[增加 减小] 来源:互联网 时间:2018-12-03

本文主要包含HTML5,样式表,css,h5,美丽,图形等相关知识,匿名希望在学习及工作中可以帮助到您

1.HTML5基础

文档类型

<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: 0; height: 0; 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 0) top left, linear-gradient(-135deg, transparent 15px, yellowgreen 0) top right, linear-gradient(-45deg, transparent 15px, yellowgreen 0) bottom right, linear-gradient(45deg, transparent 15px, yellowgreen 0) bottom left; background-size: 50% 50%; background-repeat: no-repeat; }<div class="notching">我是切角,我是div</div>//07:椭圆形 .ellipse { width: 120px; height: 160px; background-color: yellowgreen; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }<div class="ellipse">我是椭圆形,我是div</div>08:梯形:伪元素加旋转透视实现梯形 .trapezoid{ position: relative; width: 60px; padding: 60px; } .trapezoid::before{ content:""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; 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: 0; 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: 0; left: -30px; border-right: 30px solid yello

您可能想查找下面的文章:

  • HTML5知识点总结
  • HTML5的本地存储
  • HTML5本地存储之IndexedDB
  • Html5实现文件异步上传功能
  • Html5新标签datalist实现输入框与后台数据库数据的动态匹配
  • 详解HTML5 window.postMessage与跨域
  • HTML5拖放API实现拖放排序的实例代码
  • 解决html5中video标签无法播放mp4问题的办法
  • HTML5新特性 多线程(Worker SharedWorker)
  • Html5新增标签有哪些

相关文章

  • 2018-12-03图片添加入门教程:10个图片添加零基础入门教程推荐
  • 2018-12-03为什么说html5是移动互联网的趋势?
  • 2018-12-03range对象的clone方法
  • 2018-12-03safari 支不支持HTML5的录音?
  • 2018-12-03H5移动端各种各样的列表的制作方法(七最终章)
  • 2017-08-06html5版canvas自由拼图实例
  • 2018-12-03HTML5中canvas元素如何绘制图形
  • 2018-12-03用HTML5 实现橡皮擦的涂抹效果的教程_html5教程技巧
  • 2018-12-03配置H5的滚动条样式
  • 2018-12-03实现卡片3D翻转效果

文章分类

  • html/xhtml
  • html5
  • CSS
  • XML/XSLT
  • Dreamweaver教程
  • Frontpage教程
  • 心得技巧
  • bootstrap
  • vue
  • AngularJS
  • HBuilder教程
  • css3
  • 浏览器兼容
  • div/css
  • 网页编辑器
  • axure

最近更新的内容

    • 详解HTML5中的manifest缓存使用_html5教程技巧
    • 分享h5 canvas圆圈进度条的实例代码
    • HTML5移动端-viewport的详解
    • H5中History模式的使用详解
    • 如何区别html5离线存储和本地缓存实例详解
    • HTML5对比HTML4的主要改变和改进总结
    • javascript html5 canvas实现可拖动省份的中国地图
    • html5 canvas的绘制文本自动换行的示例代码
    • 使用HTML5的链接预取功能(link prefetching)给网站提速
    • html5 canvas实现跟随鼠标旋转的箭头_html5教程技巧

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有