CSS常见样式

2017-02-18  本文已影响10人  24_Magic
  • 块级元素
    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
  • 继承属性
    border-collapse
    border-spacing
    caption-side
    color
    cursor
    direction
    font (其中包括 font-family , font-size , font-weight , font-style)
    letter-spacing
    line-height
    list-style (其中包括 list-style-image , list-style-position , list-style-type)
    text-align
    text-indent
    text-transform
    visibility
    white-space
    word-spacing
    字体呀,文本呀,颜色等的设置都是可继承属性
  • 非继承属性
    z-index
    width (其中包括 min-width , max-width)
    display
    float
    clear
    vertical-align
    unicode-bidi
    position
    top
    bottom
    left
    right
    text-decoration
    background (其中包括 background-color , background-image , background-position , background-attachment , background-repeat)
    border (其中包括 border-color , border-style , border-width , border-spacing and so on)
    padding (其中包括 padding-left , padding-right , padding-top , padding-bottom)
    margin (其中包括 margin-left , margin-right , margin-top , margin-bottom)
    outline (其中包括 outline-color , outline-style , outline-width)
    clip
    content
    非继承属性大部分都是一些和定位呀,浮动呀,盒子模型呀等有关
    参考地址
  • 先设置width(<界面width),再设置margin: auto;
  • text-align: center.
  • 运用盒模型flex.
    display: flex;
    justify-content: center;
CSS三角形.png
  • px:像素,可直接设置数值,如12px,但不能小于浏览器的最小值12px
  • em:相对单位,相对于父元素字体大小
  • rem:相对单位,相对于根元素(html)字体大小


    CSS样式px,em,rem.png

    根元素body为20px,text为body的子元素,p和h3为text的子元素,可见p元素下的字体被放大了4倍,变成了80px;而h3下的字体为20px.

font字体的设置.png

代码1
代码2
代码3
代码4
代码5

上一篇 下一篇

猜你喜欢

热点阅读