日期:2014-05-17  浏览次数:20626 次

10个有用的CSS

The top 10 most useful css snippets of today.

I have noticed myself to use a few different code snippets on a daily basis so I thought some of you might find them useful. So here we go.

    ?
  1. ? ?
    center? ? ?
    Centering a website (or other elements)
    ? ?
    The HTML
    view plaincopy to clipboardprint?
    1. <DIV?class=wrap>??
    2. </DIV>??
    3. ??
    4. <!--?end?wrap?-->??
    <!-- end wrap -->

    The CSS

    ?

    view plaincopy to clipboardprint?
    1. .wrap?{?width:960px;?margin:0?auto;}??
      .wrap { width:960px; margin:0 auto;}
    

    ?

    This is an oldie, but apperantly it is not as obvious as you would think.

    ?

    ?


  2. ? ?
    stickyfooter

    ? ?
    Sticky Footer (make footer always be on bottom without absolute positioning)

    ?
    The HTML

    ?

    view plaincopy to clipboardprint?
    1. <DIV?id=wrap>??
    2. <DIV?class=clearfix?id=main>??
    3. </DIV>??
    4. </DIV>??
    5. <DIV?id=footer>??
    6. </DIV>??

    The CSS

    ?

    view plaincopy to clipboardprint?
    1. ??*?{?margin:0;?padding:0;?} ??
    2. html,?body,?#wrap?{?height:?100%;?} ??
    3. body?>?