css基础样式
来源:互联网 发布:ubuntu怎么进入文件夹 编辑:程序博客网 时间:2024/06/05 06:34
css基础样式
常见的一些样式
1.color:red; 字体颜色
2.font-family:Microsoft YaHei;字体样式
3.text-align:center; 文字内容居中显示,它有其他可选值 left right;针对元素内容或行内元素
4.background-color:red 背景色
5.border:1px solid green; 为元素添加边框,(宽度为1,实线 ,边框颜色绿色)
6.设置字间距
p{letter-spacing:8px;}
<p>我想改变此段落的字间距</p>
7.多出后隐藏
p{height:20px;width:100px;background:red;overflow:hidden;}
<p>隐藏多余的部分隐藏多余的部分隐藏多余的部分隐藏多余的部分隐藏多余的部分</p>
8.表格边框变为单线
table{border-collapse: collapse;}
td{border: 1px solid red;}
<table>
<tr>
<td>fada</td>
<td>fada</td>
</tr>
<tr>
<td>fagsfgsda</td>
<td>fagsfgsda</td>
</tr>
</table>
9.文字首行缩进 text-indent
10.尺寸 width height
11.文字溢出用省略号显示
p{text-overflow: ellipsis;white-space: nowrap;overflow:hidden;}
12.指定文字有无装饰 text-decoration (underline下划线 overline上划线 line-through贯穿线类似删除线)
背景相关
background-color 背景颜色
background-image 背景图片(background-image:url("img/i1.jpg");width:100px;height:100px;background-size:100px;)需要指定宽高
background-repeat 背景图片是否重复 repeat-x 图片横向平铺, repeat-y ,no-repeat不重复
background-size 背景图片大小
background-attachment 背景图片是否随内容滚动 fixed相对于窗体固定,滚动条滚动图片不动,但它的容器会消失
background-position 背景图片位置(相对于外层容器)
background 复合属性 (background:url("img/i2.jpg")red no-repeat left top;
颜色相关 (color; opacity透明度,继承,如果只想让背景透明,可用background:rgba();)
指定颜色的几种方式:
颜色名称{color:green;}
RGB{color:rgb(0,0,0);}
RGBA{color:rgba(0,0,0,.5);}最后一位代表了透明度(0到1)
十六进制{color:#ffffff;}
字体相关
font-style 字体样式 normal正常 italic斜体字
font-weight 文字粗细 normal正常 lighter细体(效果和正常一样) bold粗体(相当于number为700) bolder粗体 数字表示(100~900,600以上为粗体)
font-size 字体大小
font-family 字体 SimSun 、SimHei、Microsoft YaHei
列表相关
设置列表项标记的图像 list-style-image 如: ul{list-style-image: url("img/search.png");}
去掉列表项目符号 list-style:none;
常见的一些样式
1.color:red; 字体颜色
2.font-family:Microsoft YaHei;字体样式
3.text-align:center; 文字内容居中显示,它有其他可选值 left right;针对元素内容或行内元素
4.background-color:red 背景色
5.border:1px solid green; 为元素添加边框,(宽度为1,实线 ,边框颜色绿色)
6.设置字间距
p{letter-spacing:8px;}
<p>我想改变此段落的字间距</p>
7.多出后隐藏
p{height:20px;width:100px;background:red;overflow:hidden;}
<p>隐藏多余的部分隐藏多余的部分隐藏多余的部分隐藏多余的部分隐藏多余的部分</p>
8.表格边框变为单线
table{border-collapse: collapse;}
td{border: 1px solid red;}
<table>
<tr>
<td>fada</td>
<td>fada</td>
</tr>
<tr>
<td>fagsfgsda</td>
<td>fagsfgsda</td>
</tr>
</table>
9.文字首行缩进 text-indent
10.尺寸 width height
11.文字溢出用省略号显示
p{text-overflow: ellipsis;white-space: nowrap;overflow:hidden;}
12.指定文字有无装饰 text-decoration (underline下划线 overline上划线 line-through贯穿线类似删除线)
背景相关
background-color 背景颜色
background-image 背景图片(background-image:url("img/i1.jpg");width:100px;height:100px;background-size:100px;)需要指定宽高
background-repeat 背景图片是否重复 repeat-x 图片横向平铺, repeat-y ,no-repeat不重复
background-size 背景图片大小
background-attachment 背景图片是否随内容滚动 fixed相对于窗体固定,滚动条滚动图片不动,但它的容器会消失
background-position 背景图片位置(相对于外层容器)
background 复合属性 (background:url("img/i2.jpg")red no-repeat left top;
颜色相关 (color; opacity透明度,继承,如果只想让背景透明,可用background:rgba();)
指定颜色的几种方式:
颜色名称{color:green;}
RGB{color:rgb(0,0,0);}
RGBA{color:rgba(0,0,0,.5);}最后一位代表了透明度(0到1)
十六进制{color:#ffffff;}
字体相关
font-style 字体样式 normal正常 italic斜体字
font-weight 文字粗细 normal正常 lighter细体(效果和正常一样) bold粗体(相当于number为700) bolder粗体 数字表示(100~900,600以上为粗体)
font-size 字体大小
font-family 字体 SimSun 、SimHei、Microsoft YaHei
列表相关
设置列表项标记的图像 list-style-image 如: ul{list-style-image: url("img/search.png");}
去掉列表项目符号 list-style:none;
阅读全文
0 0
- CSS样式语法基础
- CSS样式语法基础
- CSS样式基础
- CSS样式基础语法
- CSS样式表基础
- CSS样式语法基础
- css样式基础学习
- CSS样式基础分享
- CSS样式基础
- CSS样式基础学习
- CSS基础—样式
- CSS样式表基础
- CSS基础之样式
- CSS基础-样式类型
- CSS样式基础
- CSS基础动画样式
- css基础样式
- Css基础样式学习
- Win 7 用虚拟机安装Ubuntu系统
- ubuntu ssh使用详解
- HDU 2141 详解
- 金融风控-->申请评分卡模型-->特征工程(特征分箱,WOE编码)
- Trip report: Summer ISO C++ standards meeting (Toronto)
- css基础样式
- 实验 9-1 1. 实现以下功能 a) 调用 pipe()创建无名管道 b) 调用 fork 创建一个子进程 c) 在子进程中向管道内写入 128k 数据,打印出进程号及成功写入的字节数 d) 在父
- 死锁的四个必要条件
- EMC的一个笔试题目
- Linux下RTC驱动的简单分析
- ★实验 9-2 1.补全代码,实现以下功能 a)调用pipe()创建无名管道 b)调用fork创建一个子进程 c)在父进程中向管道写入 “helloworld”, 同时打印出PID和写入
- Gradle for Android-高级Build和自定义
- ★实验9-3 1.用不同的方案实现两个命令的连接,例如 “who|sort”、“ps aux | grep init” 源程序: #include <stdio.h> #include <sys
- 【Nginx】Nginx优秀特点