CSS - 基础

css: 层叠样式表 决定了网页上的内容如何呈现 -->化妆师
css:分类
行内样式:针对某一行生效
例:<p style="color: red;">一段文字变色

内嵌样式:针对当前页面有效

<head>
      <title></title>
      <style type="text/css"></style>
</head>

选择器
-->id #id不常用

/*一段文字变色*/
html:<style type="text/css"></style>
<p id=".起的名字">
css:#p2(刚才起的名字){
	color:red;
}

-->类:为标签加入属性class

/*一段文字变色*/
html:<class=".起的名字">
css:.刚才起的名字{
      color:red;
}

-->标签:为指定标签设置统一样式 标签名{}

/*一段文字变色*/
css:p(标签){
      color:red;
}

外部样式:可以使多个页面共享样式

<head>
      <title></title>
      <link type="text/css" rel="stylesheet" href="填写css地址"/>
</head>

常用的样式:css

color: /*字体颜色*/
font-size: 数字px; /*字体大小 单位是像素*/
font-family: “字体”; /*选择字体*/
font-weight:bold; /*字体加粗*/
background-color: 选择颜色; /*背景颜色*/
background-image: 选择图片; /*背景图片*/
border:颜色 1px(像素) solid(实线); /*边框*/
      border-top: 颜色 1px(像素) solid(实线); /*上边框*/
      border-left: 颜色 1px(像素) solid(实线); /*左边框*/
      border-bottom: 颜色 1px(像素) solid(实线); /*下边框*/
      border-right: 颜色 1px(像素) solid(实线); /*右边框*/
text-align: center; /*文字及图片的水平对齐方式*/
text-decoration: underline; /*下划线*/
text-decoration: none; /*去掉下划线*/
list-style-type: none; /*去掉无序列表的点*/
list-style-image: ulr 图片; /*无序列表的点变成图片*/
border-radius: 数字px; /*设置边框圆角*/
margin-top: 填写方向; /*外边距*/
letter-spacing: 数字px; /*调节文字间距*/
line-height: 数字px; /*文字居中,数字与边框高度(宽度)相同*/
width: 宽度px;
height: 高度px;
float: left; /*li标签在div横过来*/

超级链接样式

a{
	
} /*基础样式*/
a:hover{
	
} /*鼠标悬浮的样式*/
a:visited{
	
} /*访问过的样式*/
posted @ 2020-11-15 15:36  NoahEavlia  阅读(71)  评论(0编辑  收藏  举报