css知识点

本文详细介绍了CSS中的各种概念和技术,包括html基础框架、背景、元素类型、字体样式、链接样式、文本修饰、列表样式、边框、轮廓、外边距、隐藏方式以及定位方法,帮助读者深入理解CSS并提升布局能力。
摘要由CSDN通过智能技术生成

一,html基础框架

<!DOCTYPE html>版本号
<html>
	<head>头部
		<meta charset="utf-8">字符集编码方式(国际通用)
		<title></title>文档标题
	</head>
	<body>主体
	</body>
</html>

二,background;背景

background-color背景颜色
		 background-image:url(图片地址)背景图片
		 background-repeat:no-repeat背景图片是否平铺
		 background-attachment:fixed背景图像是否固定或者随着页面的其余部分滚动。
		 background-position背景的位置 
		 background:#ffffff url('img_tree.png') no-repeat right top简写形式
					颜色		图片路径				是否平铺		背景位置-->
		<!-- 注:设置背景要么单独设置,要么简写形式设置

三,块,行,行内块元素

块:div,p,h1~h6uloldlliddtablehrblockquoteaddresstablemenupreheadersectionasidefooter

行内:spanalableabbr(缩写)em(强调)bigcite(引用)i(斜体)q(短引用)selectsmallsube,b

行内块:imginputtextarea

四,字体

font-size字体大小
font-style斜体
font-family字体样式
font-weight粗细

例;

<div style="font-weight: bold;">
			我是div
		</div>

font-weight

 font-style;

五 链接

        a:link - 正常,未访问过的链接
        a:visited - 用户已访问过的链接
        a:hover - 当用户鼠标放在链接上时
        a:active - 链接被点击的那一刻

a:link {color:#000000;}      /* 未访问链接*/
a:visited {color:#00FF00;}  /* 已访问链接 */
a:hover {color:#FF00FF;}  /* 鼠标移动到链接上 */
a:active {color:#0000FF;}  /* 鼠标点击时 */

文本修饰

text-decoration 属性主要用于删除链接中的下划线:


a:link {text-decoration:none;}
a:visited {text-decoration:none;}
a:hover {text-decoration:underline;}
a:active {text-decoration:underline;}

六,列表

基本语法格式

<table>

<tr>

<td></td>

</tr>

</table>

<tr>:表格中的一行。<td>:表格中的单元格

表格属性:

border:设置表格的边框 width:设置表格宽度 heighe:设置表格的高度 align:设置表格在网页中的水平对齐方式 cellspacing:单元格和单元格之间的距离 cellpadding:单元格内容距离单元边框的距离

三参为零:border=”0”,ceiispacing=”0”,cellpadding=”0”

表头位于表格的第一行或第一列 其文本加粗居中 即<th></th>代替相应的单元格标签<td></td>

表格标题:caption

定义:<table>

                     <caption>我是标题</caption>

              </table>

<tr>标签只包含<td>和<caption>标签

<caption>标签必须紧随table标签之后

合并单元格;

跨行合并:rowspan  跨列合并:colspan

公式;删除的个数=合并的个数-1

顺序 先上后下 先左后右

七,边框;border  轮廓;outline  

设置一个元素所有外边距的宽度,或者设置各边上外边距的宽度;margin

        border-color 修改边框颜色
         border-top-color
         border-right-color
         border-bottom-color
         border-left-color
         border-width修改边框宽度
         border-style修改边框线条样式
         ·none:没有边框,即忽略所有边框的宽度(默认值)
         ·solid:边框为单实线
         ·dashed:边框为虚线
         ·dotted:边框为点线
         ·double:边框为双实线
         border-top修改边框某一边
  例      

<div style="width: 100px;height: 100px;
        border: 5px solid red;
        border-top: 10px dashed orange">
   </div>

轮廓;


		<div style="width: 100px;height: 100px;
		border: 5px solid red;
		outline:10px dashed #000">
		</div> 

margin

        margin:上 右 下 左;
        margin:上 右左 下;
        margin:上下 右左;

八,Css中隐藏的三种方式
        display: none;隐藏,不占位置
        visibility: hidden;隐藏,占位置
        opacity: 0;透明度,0为隐藏,1显示

九,定位 
         static默认值
        relative相对定位,脱离文档流
        fixed固定定位
        absolute绝对定位,如果父级没有相对定位,
        那么他的父级就是浏览器,脱离文档流,
        如果父级没有相对或绝对定位会一直往上一级找,直到浏览器
        找到父级有相对或绝对定位,根据父级定位
        sticky粘性定位

<div style="position: relative;">
			<div style="width: 100px;height: 100px;
			border: 1px solid red;
			margin: 100px;
			top: 50px;left: 100px;
			position: relative;">
				1
				<div style="width: 30px;height: 30px;
				border: 1px solid red;
				position: absolute;
				top: 0;
				left: 0;">
					2
				</div>
			</div>
		</div>

固定定位;

<div style="width: 50px;height: 50px;
		border: 1px solid orange;
		border-radius: 50%;
		position: fixed;
		right: 0;
		bottom: 50px;
		text-align: center;
		line-height: 50px;
		font-size: 30px;
		font-weight: 700;">↑</div>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值