CSS基础2--属性

126 阅读2分钟

width    min-width    max-width

height   min-height  max-height

overflow: scroll|hidden|auto

font-size浏览器默认的字体大小是16px,设置的是字体高度,宽度自动缩放

font-weight 字体粗细  lighter|normal|bold|bolder

font-style: italic|oblique|normal  斜体|倾斜  oblique强制字体倾斜

<em>默认斜体,有语义,强调

font-family:有空格的或者中文需要加双引号 如"Times New Roman"

通用字体:arial

color: 英文单词颜色设置|十六进制的颜色值

光学三原色

red         green        blue

00-ff       00-ff          00-ff     ->十六进制

0-255     0-255       0-255      ->rgb(0,0,255)


border: 1px solid #000;

可视区域:(width+左边框+右边框)*(height+上边框+下边框)

border-style:dotted|dashed|solid|double|groove|ridge|inset|outset

三角形的写法


text-align:right|center|left;     对齐必须是相对有宽高的容器

line-height     文字行高 默认22


文本缩进

text-indent:2em;   默认 1em=16px;  若想1em=10px可设置font-size:52.6


text-decoration:none|underline|line-through|overline

                                       ins                del

cursor: pointer(光标小手)|not-allowed(禁用)


单行文本截断和显示省略号的三大件

white-space: nowrap;       //不换行

overflow-x: hidden;

text-overflow: ellipsis;    //隐藏部分加省略号


display

block|inline-block|


伪类选择器:

hover  鼠标移动上边的样式

disabled

checked


display:none  和  visibility:hidden 的区别

visibility:hidden保留被隐藏元素所占据的HTML文档空间

display:none 不保留被隐藏元素所占据的HTML文档空间


opacity:值越大透明度越低,值越小透明度越高

label的for起作用的三个条件:1同父级 2相邻  3在其之后

改变CheckBox的样式的方法:

input:focus{border:1px solid green}  聚焦后有绿色边框


div span:first-child{}

div span:last-child{}

:nth-child(odd)   伪类      n   sixth

vertical-align: middle|top|bottom|像素


容器内多行文本居中的方法:

1容器  display:table

2容器内文本  display:table-cell(表格单元格属性)

3容器内文本 vertical-align:middle


通处理:

ul{

padding: 0;

margin: 0;

list-style: none;

}

h1,h2,h3,h4,h5,h6{ font-weight:normal;}

input,textarea,button{

outline:none;

}

a{text-decoration:none;}

i,em{font-weight:normal;}