FE-study

CSS-CSS常见样式

2017-09-04  本文已影响0人  饥人谷_bigJiao

1.块级元素和行内元素分别有哪些?

div h1 h2 h3 h4 h5 h6 p hr
form ul dl ol pre table
li dd dt tr td th
em strong span a br img 
button input label select textarea
code script

-注意: input默认为inline-block

2.什么是 CSS 继承? 哪些属性能继承,哪些不能?

字体相关属性:font,font-family,font-weight,font-size,font-style,font-stretch,font-size-adjust
文本相关属性:text-indent(文本缩进),text-align,line-height,word-spacing,letter-spacing,text-transform,direction,color
元素可见性:visibility
表格布局属:caption-side,border-collapse,border-spacing,empty-cells,table-layout<br列表布局属性:list-style-type,list-style-image,list-style-position,list-style
生成内容属性:quotes
光标属性:cursor
页面样式属性:page,page-break-inside,window,orphans
声音样式属性:speak,speak-punctuation….

display
文本属性:vertical-align,text-shadow,text-decoration,white-space,unicode-bidi
盒子模型相关属性:width,height,margin,border,padding
背景相关属性:background,background-XXX
定位属性:float,clear,position,top,right,bottom,left,min-width,min-height,max-width,max-height,overflow,clip,z-index
生成内容属性:content,counter-reset,counter-increment
轮廓样式属性:outline-style,outline=width,outline-color,outline
页面样式属性:size,page-break-before,page-break-after
声音样式属性:pause-before,pause-after,pause,cue-before,cue-after,cue,play-during

3.如何让块级元素水平居中?如何让行内元素水平居中?

4.用 CSS 实现一个三角形

三角形代码

5.单行文本溢出加 ...如何实现?

selector{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

测试

6.px, em, rem 有什么区别

7.解释下面代码的作用?为什么要加引号? 字体里\5b8b\4f53代表什么?

body{
  font: 12px/1.5 tahoma,arial,'Hiragino Sans GB','\5b8b\4f53',sans-serif;
}

ps: 用Unicode码表示字体时,打开控制台 escape('微软雅黑'),把 %u替换成 \

8.样式代码实现

8-1

8-2

8-3

8-4

8-5

上一篇 下一篇

猜你喜欢

热点阅读