css文件

/* 注释内容 */

/* 选择器,其中body就是一个选择器,表示选中个body这个标签
声明块:为选择器设置样式
{
样式名: 样式值;
}
*/
body{
background-color: aquamarine;
} /* 元素选择器:根据标签来选中指定的元素 ,例如 body{},p{},div{}*/
p{
color: blue;
} /* id选择器,根据元素的id属性值选中一个元素,语法#id属性值{},例如 #box{} */
#box{
height: 100px;
} /* class选择器,根据元素的class属性值选中元素,语法 .class属性值{}
一个元素可以使用多个class <!-- 设置一个不重复id属性 -->
<b id="box">id box</b>
<!-- 一个元素可以设置多个class属性 -->
<del class="blue test">class blue</del>
*/
.blue{
color: blue;
} /* 伪类选择器 */
.blue::after{
/* 类加载之后 */
color: #9198e5;
}
/* 边框样式 */
div[title=div1]{
/* 线条粗细 */
border: 5px solid; /* 圆角
四个值: 第一个值为左上角,第二个值为右上角,第三个值为右下角,第四个值为左下角。
三个值: 第一个值为左上角, 第二个值为右上角和左下角,第三个值为右下角
两个值: 第一个值为左上角与右下角,第二个值为右上角与左下角
一个值: 四个圆角值相同: 重要
*/
border-radius: 25px; /* 内边距(内容与div的距离) */
padding: 10px 40px; /* 集中定义各种背景属性(color,image,origin) */
background: #dddddd;
width: 300px; /* div阴影效果 */
box-shadow: 10px 10px 5px #888888;
/* 给阴影添加颜色 */
box-shadow: 10px 10px grey; /* 边界图片 */
border-image: url(./rng.png) 30 30 round;
} #example1{
background-image: url(./rng.png); /* 为背景图片设置初始位置*/
background-position: right bottom; /* 设置背景图片显示样式(居中,拉伸等) */
background-repeat: no-repeat; /* 设置背景图大小 */
background-size: 100% 100%; /* 背景图像的位置区域(内边距的位置,div内容的位置,外边距的位置) */
background-origin: content-box; /* 裁剪背景 */
background-clip: content-box; padding: 30px 50px;
width: 300px;
height: 500px;
} #grad1{
height: 200px;
background-color: red;
/* 从上到下由红开始渐变 */
background-image: linear-gradient(#e66465, #9198e5); /* 从左到又开始渐变 */
background-image: linear-gradient(to right, red, yellow); /* 从左上角到右下角渐变 */
background-image: linear-gradient(to bottom right, red, yellow); /* 透明度 */
background-image: linear-gradient(to right, rgba(255,0,0,0), rgba(255,0,0,1)); /* 重复的线性渐变 */
background-image: repeating-linear-gradient(red, yellow 10%, green 20%); /* 径向渐变 */
background-image: radial-gradient(red,yellow,green); /* 设置形状
shape 参数定义了形状。它可以是值 circle 或 ellipse。
其中,circle 表示圆形,ellipse 表示椭圆形。默认值是 ellipse。
*/
background-image: radial-gradient(circle, red, yellow, green);
} /* css3的文本样式 */
h1{
/* 文本阴影 */
text-shadow: 5px 5px 5px #FF0000;
} p{
white-space: nowrap;
width: 200px;
border: 1px solid #000000;
overflow: hidden;
/* 设置文本溢出的样式 ellipsis 显示..., clip 显示最后能显示全的字符*/
/* text-overflow: ellipsis; */
text-overflow: clip; /* 换行 */
word-wrap: break-word;
} /* 字体引用 */
@font-face{
font-family: serif;
src: url();
font-weight: bold;
} /* 2D转换 */
div{
transform: rotate(30deg);
/* ie 9 */
-ms-transform: rotate(30deg);
/* Safar */
-webkit-transform: rotate(30deg);
} /* 3D转换 */
#example1{
transform: rotateX(120deg);
-webkit-transform: rotateX(120deg); /* Safari 与 Chrome */
} /* 过渡 */
div{
width:100px;
height:100px;
background:red;
transition:width 1s linear 2s;
/* Safari */
-webkit-transition:width 1s linear 2s;
} div:hover
{
width:300px;
} /* css动画 */
div
{
width:100px;
height:100px;
background:red;
position:relative;
animation:myfirst 5s linear 2s infinite alternate;
/* Firefox: */
-moz-animation:myfirst 5s linear 2s infinite alternate;
/* Safari and Chrome: */
-webkit-animation:myfirst 5s linear 2s infinite alternate;
/* Opera: */
-o-animation:myfirst 5s linear 2s infinite alternate;
} @keyframes myfirst
{
0% {background:red; left:0px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
} @-moz-keyframes myfirst /* Firefox */
{
0% {background:red; left:0px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
} @-webkit-keyframes myfirst /* Safari and Chrome */
{
0% {background:red; left:0px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
} @-o-keyframes myfirst /* Opera */
{
0% {background:red; left:0px; top:0px;}
25% {background:yellow; left:200px; top:0px;}
50% {background:blue; left:200px; top:200px;}
75% {background:green; left:0px; top:200px;}
100% {background:red; left:0px; top:0px;}
} /* css3 调整尺寸 */
div{
resize:both;
overflow: auto;
} /* 响应式图片 */
img{
max-width: 100%;
height: auto;
} /* css框大小 */
div{
width: 300px;
height: 100px;
padding: 50px;
border: 1px solid red;
/*
元素上设置了 box-sizing: border-box;
则 padding(内边距) 和 border(边框) 也包含在 width 和 height 中:
*/
box-sizing: border-box;
} /* css3 弹性盒子 flex box(响应式) */
/* https://www.runoob.com/css3/css3-flexbox.html */ /* 多媒体查询 */
/* https://www.runoob.com/css3/css3-mediaqueries.html */ /* 布局grid */
/* https://developer.mozilla.org/zh-CN/docs/Web/CSS/grid */

html文件

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title> <!-- 内部样式,写在head中,设置标签的值,可同时为所有这个标签设置样式 -->
<style>
h1{
color: red;
}
</style>
<!-- 引入外部样式表 -->
<link rel="stylesheet" href="css01.css">
</head>
<body>
<!-- css内联样式 -->
<p style="color: red; font-size: 100px;">字符</p>
<h1>设置样式</h1> <!-- 设置一个不重复id属性 -->
<b id="box">id box</b>
<!-- 一个元素可以设置多个class属性 -->
<del class="blue" class="test">class blue</del> <div title="div1">border-radius 属性允许您为元素添加圆角边框!</div> <div id="example1">
<h1>Lorem Ipsum Dolor</h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
<p>Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
</div> <h3>线性渐变 - 从上到下</h3>
<p>从顶部开始的线性渐变。起点是红色,慢慢过渡到蓝色:</p> <div id="grad1"></div> <div>This is some long text that will not fit in the box</div>
<p>div 使用 &quot;text-overflow:clip&quot;:</p></div>
</body>
</html>

CSS部分样式知识的更多相关文章

  1. css字体样式(Font Style),属性

    css字体样式(Font Style),属性   css字体样式(Font Style)是网页中不可或缺的样式属性之一,有了字体样式,我们的网页才能变得更加美观,因此字体样式属性也就成为了每一位设计者 ...

  2. HTML+CSS+JS基础知识

    HTML+CSS+JS基础知识 目录 对HTML+CSS+JS的理解 基础知识 对HTML+CSS+JS的理解 基础知识 插入样式表的三种方式 外部样式表:<link rel="sty ...

  3. 纯CSS菜单样式,及其Shadow DOM,Json接口 实现

    先声明,要看懂这篇博客要求你具备少量基础CSS知识, 当然如果你只是要用的话就随便了,不用了解任何知识 完整项目github链接:https://github.com/git-Code-Shelf/M ...

  4. 关于jquery的css的一些知识

    Query实例CSS 样式表动态选择本实例主要说的还是jquery的选择器,关于jquery的css的一些知识用类似 $("li").css("cursor", ...

  5. css 字体样式设置

    css字体样式(Font Style),属性 时间:2014-05-08 21:49 来源:我爱学习网 | 作者:我爱学习网 | 本文已影响 68353 人   css字体样式(Font Style) ...

  6. CSS的相关知识——背景,超链接,列表,表格,奇偶选择器

    接着上一篇总结一些css的相关知识 ㈠背景 背景属性 1.background-color 背景颜色   rgb函数设置 2.background-image   背景图片  url(“logo.jp ...

  7. CSS数据样式

    CSS数据样式 表格 定制表格 我们除了可以使用<table>标签进行绘制表格,在css3中display也支持进行表格的样式绘制. 样式规则 说明 table 对应 table tabl ...

  8. 精简的网站reset 和 css通用样式库

    参考链接:http://www.zhangxinxu.com/wordpress/2010/07/我是如何对网站css进行架构的/ reset.css body{ line-height:1.4; c ...

  9. css初始化样式代码

    为什么要初始化CSS? CSS初始化是指重设浏览器的样式.不同的浏览器默认的样式可能不尽相同,所以开发时的第一件事可能就是如何把它们统一.如果没对CSS初始化往往会出现浏览器之间的页面差异.每次新开发 ...

随机推荐

  1. 蒲公英 · JELLY技术周刊 Vol.13 跟 VSCode 学习如何开发大型 IDE 项目

    开发一个 IDE 很难么?这或许是件很难的事情,但当我们参考 VSCode 的技术构架来看,整个开发流程就会平滑顺畅很多,从内核开发.代码编辑器.视图结构到插件系统,在这整个技术构架中我们可以看到很多 ...

  2. dotnet core 在 MIPS 下的移值进度

    本文仍处于修订中 写在开始前 我们的主要业务基于 dotnet core 2.x 与 3.1 完成,目前 dotnet core 3.1 支持的 CPU 架构列表中还不包含龙芯,且在 gitlab i ...

  3. day11总结

    """1.什么是函数 具备某一功能的工具===>函数 事先准备工具的过程===>函数的定义 遇到应用场景拿来就用=>函数的调用 2.为何要有函数 内置函 ...

  4. 北航2018级算法期末上机实录随笔1st

    简单记录下题目类型和做题情况,理性复习同时也希望提供一些参考 题目描述 共计八个题目,按照助教的划分,题目分类如下 一个签到(二分查找),两个板子(活动选择.KMP(洛谷kmp模板题)),一个板子变形 ...

  5. 解决vue项目中使用ivew定制主题报 .bezierEasingMixin();错误

    背景:在使用view-design(iview)定制主体时(覆盖变量方式)出现less错误 完整错误如下 解决方法: 在vue.config.js中添加 less-loader:5.0.x modul ...

  6. Scala 基础(十二):Scala 函数式编程(四)高级(二)参数(类型)推断、闭包(closure)、函数柯里化(curry)、控制抽象

    1  参数(类型)推断 参数推断省去类型信息(在某些情况下[需要有应用场景],参数类型是可以推断出来的,如list=(1,2,3) list.map() map中函数参数类型是可以推断的),同时也可以 ...

  7. 数据可视化之powerBI基础(十)快速度量值,帮你更快的进行数据分析

    https://zhuanlan.zhihu.com/p/64414831 刚开始学习PowerBI,最头疼的可能就是度量值了,毕竟用了Excel这么多年,只相信自己眼睛看到的,对于这个"虚 ...

  8. 微信小程序接口封装、原生接口封装、request、promise封装

    相信大家在做微信小程序的时候会有很多地方需要调用接口,就和pc以及手机端一样,多个页面多次调用会有很多状态,那为了节省大家的开发时间就会需要给请求的接口做一些简单封装,便于开发,在这里我用了两个js, ...

  9. 微信小程序wx.switchTab跳转到tab页面后onLoad里面的方法不执行

    相信大家在做小程序的时候启动页跳转到tab首页会用到switchTab 但是在跳转后发现页面模块不全,后面console.log()后发现是onLoad里面的方法不执行 解决这种问题的方法页有很多中, ...

  10. J.U.C体系进阶(五):juc-collections 集合框架

    Java - J.U.C体系进阶 作者:Kerwin 邮箱:806857264@qq.com 说到做到,就是我的忍道! juc-collections 集合框架 ConcurrentHashMap C ...