HTML初步2 CSS

选择器,声明
以分号结束,声明组以大括号括起来
盒子模型
上右下左
/**/ 注释
CSS 中 id 选择器以 “#” 来定义,id 不要以数字开头
类选择器以一个点"."号显示
选择器

层叠次序:浏览器缺省设置<外部样式表<内部样式表(位于 head 标签内部)<内联样式(在 HTML 元素内部)
多重样式优先级顺序: 通用选择器(*)<元素(类型)选择器<类选择器<属性选择器<伪类<ID 选择器<内联样式

CSS Backgrounds

background-color
background-image
background-repeat repeat-x/y,no-repeat
background-attachment fixed固定
background-position top/bottom/left/right/center,%(水平竖直),px/cm(左上角向右向下)

CSS Text

color
direction rtl
text-align center/right/justify
vertical-align text-top/text-bottom
white-space nowrap
text-shadow px px color
text-decoration none/overline/line-through/underline
line-height %
text-transform uppercase/lowercase/capitalize
text-indent 文本缩进 px
letter-spacing 字符间距
word-spacing 字间隔 px

CSS Fonts字体
font-famliy:""
Serif 字体
Sans-serif 字体
Monospace 字体
Cursive 字体
Fantasy 字体

font-style normal/italic/oblique
font-size px,em,%(body)
font-weight normal/lighter/bold/900
font-variant samll-caps/normal

CSS Link

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

a:hover 必须跟在 a:link 和 a:visited后面,a:active 必须跟在 a:hover后面

CSS 列表样式

list-style-type 无序:circle/square/none/disc,有序:upper-roman/lower-roman/upper-alpha/lower-alpha/demical(阿拉伯数字)/decimal-leading-zero/cjk-ideographic(中文)/none/inherit
list-style-image

CSS Table

border
border-collapse:collapse
width
height
text-align
vertical-align
padding
caption-side

CSS Border

boder-style none/dotted/dashed/solid/double/groove/ridge/inset/outset
border-width px/em,yhin/medium/thick
border colour transparent
border-top/right/bottom/left-style

CSS outline

类比border

扫描二维码关注公众号,回复: 3563054 查看本文章

CSS Margin

auto设置浏览器边距
length
%
margin可为负值

CSS Padding

length
%
不可为负值

CSS Display 与Visibility

visibility:hidden 仍然影响布局
diplay:none 从页面布局中消失
display inline/block

CSS定位

psition属性的四种值:

  • static定位,默认值
  • fixed 相对于窗口固定
  • relative 可在相对原来基础上再加改变
  • absolute
    z-index属性,指定堆叠顺序,值为正负数默认情况下先定位在下面
    clip属性,裁剪
    cursor属性,改变鼠标样式
    overflow属性,值有visible,hidden,scroll,inherit,规定当内容溢出元素框时发生的事情

CSS 伪类

a:link* 未访问的链接 *
a:visited* 已访问的链接 *
a:hover 鼠标划过链接 *
a:active * 已选中的链接 *
first-child
first-letter
first-line
focus

布局

header 定义文档或节的页眉
nav 定义导航链接的容器
section 定义文档中的节
article 定义独立的自包含文章
aside 定义内容之外的内容(比如侧栏)
footer 定义文档或节的页脚
details 定义额外的细节
summary 定义 details 元素的标题

猜你喜欢

转载自blog.csdn.net/irontonystark/article/details/82924249