zoukankan      html  css  js  c++  java
  • 各大型网站用的全局样式

    新浪网:

    /* 全局样式 */
    body,ul,ol,li,p,h1,h2,h3,h4,h5,h6,form,fieldset,table,td,img,div{margin:0;padding:0;border:0;}
    body{background:#fff;color:#333;font-size:12px; margin-top:5px;font-family:"SimSun","Arial Narrow";}

    ul,ol{list-style-type:none;}
    select,input,img,select{vertical-align:middle;}

    a{text-decoration:underline;}
    a:link{color:#009;}
    a:visited{color:#800080;}
    a:hover,a:active,a:focus{color:#c00;}

    .clearit{clear:both;}

    /* page */
    #page{950px; overflow: visible; _display:inline-block; margin:0 auto;}

    中华网:

    body {background:#fff; text-align:center; font-size:12px; font-family:simsun;}
    input, select {font-size:12px;}
    ul, li {list-style-type:none;}
    body, form, ul, li, dl, dd, h1, h2, h3, p, button {margin:0; padding:0;}
    button, img {border:none;}
    a {color:#000; text-decoration:none; font-size:12px;}
    a:hover {color:#c00; text-decoration:underline;}
    cite,em {font-style:normal;}

    /* colors */
    .title_default {}
    .title_black {color:black !important;}
    .title_red {color:red !important;}
    .title_blue {color:#013694 !important;}
    .title_green {color:green !important;}
    .title_brown {color:brown !important;}
    .title_gray {color:gray !important;}


    #container {background:#fff; 950px; margin:0 auto;}

    淘宝网:
    body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,legend,button,input,textarea,th,td{margin:0;padding:0;}
    body,button,input,select,textarea{font:12px/1.5 tahoma,arial,\5b8b\4f53,sans-serif;}
    h1,h2,h3,h4,h5,h6{font-size:100%;}
    address,cite,dfn,em,var{font-style:normal;}
    code,kbd,pre,samp{font-family:courier new,courier,monospace;}
    small{font-size:12px;}ul,ol{list-style:none;}
    a{text-decoration:none;}
    a:hover{text-decoration:underline;}
    sup{vertical-align:text-top;}
    sub{vertical-align:text-bottom;}
    legend{color:#000;}fieldset,img{border:0;}
    button,input,select,textarea{font-size:100%;}
    table{border-collapse:collapse;border-spacing:0;}

    中彩网:

    @charset "utf-8";

    /*YUI Reset*/
    /*body { text-align:center;}*/
    * { /*text-align:left;*/ font-size:12px;}
    html{color:#000;background:#FCFCFC;}
    body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}
    /*table{border-collapse:collapse;border-spacing:0;}*/
    fieldset,img{border:0;}
    address,caption,cite,code,dfn,em,th,var{font-style:normal;font-weight:normal;}
    li{list-style:none;}
    caption,th{text-align:left;}
    h1,h2,h3,h4,h5,h6{font-size:100%;}
    q:before,q:after{content:'';}
    abbr,acronym {border:0;font-variant:normal;}
    sup {vertical-align:text-top;}
    sub {vertical-align:text-bottom;}
    input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}
    input,textarea,select{*font-size:100%;}
    legend{color:#000;}
    del,ins{text-decoration:none;}


    a { color:#000; text-decoration:none;}
    a:hover { color:#000; text-decoration:underline;}
    hr{height:1px;border:none;border-top:1px solid #CCC;margin:0;*margin:-10px 0 -14px 0;_margin:-6px 0 -14px 0;float:none;*float:left;display:block;}

    /*ClearFix*/
    .clearfix {
     display: inline-block;
    }
    .clearfix:after {
     /*/*/content: "."; /* HACK for IE8 */
     display: block;
     height: 0;
     clear: both;
     visibility: hidden;
    }
    /* Hides from IE-mac \*/
    * html .clearfix {
     height: 1%;
    }
    .clearfix {
     display: block;
    }


    /*ClearFix*/
    .main01,.main02,.main03,.main_ssq,.main_cpsc,.main_ggl {
     display: inline-block;
    }


    非常感谢Perishable的整理与归纳,以下是由某人翻译

    _________________________

    Minimalistic Reset [ Version 1 ]
    相信这一段你经常看到.而且也是我们经常用到的

    引用内容
    * {
    padding: 0;
    margin: 0;
    }



    Minimalistic Reset [ Version 2 ]
    border:0的设计有些不靠谱了

    引用内容
    * {
    padding: 0;
    margin: 0;
    border: 0;
    }




    Minimalistic Reset [ Version 3 ]
    当然这个也是不推荐的.会跟某些默认样式有冲突

    引用内容
    * {
    outline: 0;
    padding: 0;
    margin: 0;
    border: 0;
    }


    _________________________


    Condensed Universal Reset
    这是作者当前比较钟意的一种写法.保证了相对普遍浏览器样式的统一性.

    引用内容
    * {
    vertical-align: baseline;
    font-weight: inherit;
    font-family: inherit;
    font-style: inherit;
    font-size: 100%;
    border: 0 none;
    outline: 0;
    padding: 0;
    margin: 0;
    }

    _________________________


    Poor Man’s Reset
    其实这也是我们常用的一类Css Reset.对字体的大小复位,以及图片链接的边框处理.
    也经常在某些站点看到


    引用内容
    html, body {
    padding: 0;
    margin: 0;
    }
    html {
    font-size: 1em;
    }
    body {
    font-size: 100%;
    }
    a img, :link img, :visited img {
    border: 0;
    }


    _________________________


    Shaun Inman’s Global Reset
    作者认为Shaun写这类的Css Reset是有某种目的性.
    而且这类规则是针对的是某些重要的常用浏览器.
    比如ie,firefox等

    引用内容
    body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre,
    form, fieldset, input, p, blockquote, table, th, td, embed, object {
    padding: 0;
    margin: 0;
    }
    table {
    border-collapse: collapse;
    border-spacing: 0;
    }
    fieldset, img, abbr {
    border: 0;
    }
    address, caption, cite, code, dfn, em,
    h1, h2, h3, h4, h5, h6, strong, th, var {
    font-weight: normal;
    font-style: normal;
    }
    ul {
    list-style: none;
    }
    caption, th {
    text-align: left;
    }
    h1, h2, h3, h4, h5, h6 {
    font-size: 1.0em;
    }
    q:before, q:after {
    content: '';
    }
    a, ins {
    text-decoration: none;
    }


    _________________________


    Yahoo CSS Reset
    yahoo这帮家伙写的Reset觉得可以推荐

    引用内容
    body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td {
    padding: 0;
    margin: 0;
    }
    table {
    border-collapse: collapse;
    border-spacing: 0;
    }
    fieldset,img {
    border: 0;
    }
    address,caption,cite,code,dfn,em,strong,th,var {
    font-weight: normal;
    font-style: normal;
    }
    ol,ul {
    list-style: none;
    }
    caption,th {
    text-align: left;
    }
    h1,h2,h3,h4,h5,h6 {
    font-weight: normal;
    font-size: 100%;
    }
    q:before,q:after {
    content:'';
    }
    abbr,acronym { border: 0;
    }



    _________________________


    Erik Meyer’s CSS Reset
    作者将Erik Meyer的代码重新整理了.但功能上还是一样的
    这套Css Reset是业内是使用最多的

    引用内容
    html, body, div, span, applet, object, iframe, table, caption, tbody, tfoot, thead, tr, th, td,
    del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var,
    h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code,
    dl, dt, dd, ol, ul, li, fieldset, form, label, legend {
    vertical-align: baseline;
    font-family: inherit;
    font-weight: inherit;
    font-style: inherit;
    font-size: 100%;
    outline: 0;
    padding: 0;
    margin: 0;
    border: 0;
    }
    /* remember to define focus styles! */
    :focus {
    outline: 0;
    }
    body {
    background: white;
    line-height: 1;
    color: black;
    }
    ol, ul {
    list-style: none;
    }
    /* tables still need cellspacing="0" in the markup */
    table {
    border-collapse: separate;
    border-spacing: 0;
    }
    caption, th, td {
    font-weight: normal;
    text-align: left;
    }
    /* remove possible quote marks (") from <q> & <blockquote> */
    blockquote:before, blockquote:after, q:before, q:after {
    content: "";
    }
    blockquote, q {
    quotes: "" "";
    }


    _________________________


    Condensed Meyer Reset
    总的来说这是对Erik Meyer的Css Reset的修改与提升.

    引用内容

    body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6,
    pre, form, fieldset, input, textarea, p, blockquote, th, td {
    padding: 0;
    margin: 0;
    }
    fieldset, img {
    border: 0;
    }
    table {
    border-collapse: collapse;
    border-spacing: 0;
    }
    ol, ul {
    list-style: none;
    }
    address, caption, cite, code, dfn, em, strong, th, var {
    font-weight: normal;
    font-style: normal;
    }
    caption, th {
    text-align: left;
    }
    h1, h2, h3, h4, h5, h6 {
    font-weight: normal;
    font-size: 100%;
    }
    q:before, q:after {
    content: '';
    }
    abbr, acronym {
    border: 0;
    }

    MVC默认样式:

    /*----------------------------------------------------------
    The base color for this template is #5c87b2. If you'd like
    to use a different color start by replacing all instances of
    #5c87b2 with your new color.
    ----------------------------------------------------------*/
    body
    {
        background-color: #5c87b2;
        font-size: .75em;
        font-family: Verdana, Helvetica, Sans-Serif;
        margin: 0;
        padding: 0;
        color: #696969;
    }

    a:link
    {
        color: #034af3;
        text-decoration: underline;
    }
    a:visited
    {
        color: #505abc;
    }
    a:hover
    {
        color: #1d60ff;
        text-decoration: none;
    }
    a:active
    {
        color: #12eb87;
    }

    p, ul
    {
        margin-bottom: 20px;
        line-height: 1.6em;
    }

    /* HEADINGS  
    ----------------------------------------------------------*/
    h1, h2, h3, h4, h5, h6
    {
        font-size: 1.5em;
        color: #000;
        font-family: Arial, Helvetica, sans-serif;
    }

    h1
    {
        font-size: 2em;
        padding-bottom: 0;
        margin-bottom: 0;
    }
    h2
    {
        padding: 0 0 10px 0;
    }
    h3
    {
        font-size: 1.2em;
    }
    h4
    {
        font-size: 1.1em;
    }
    h5, h6
    {
        font-size: 1em;
    }

    /* this rule styles <h2> tags that are the
    first child of the left and right table columns */
    .rightColumn > h1, .rightColumn > h2, .leftColumn > h1, .leftColumn > h2
    {
        margin-top: 0;
    }

    /* PRIMARY LAYOUT ELEMENTS  
    ----------------------------------------------------------*/

    /* you can specify a greater or lesser percentage for the
    page width. Or, you can specify an exact pixel width. */
    .page
    {
        90%;
        margin-left: auto;
        margin-right: auto;
    }

    #header
    {
        position: relative;
        margin-bottom: 0px;
        color: #000;
        padding: 0;
    }

    #header h1
    {
        font-weight: bold;
        padding: 5px 0;
        margin: 0;
        color: #fff;
        border: none;
        line-height: 2em;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 32px !important;
    }

    #main
    {
        padding: 30px 30px 15px 30px;
        background-color: #fff;
        margin-bottom: 30px;
        _height: 1px; /* only IE6 applies CSS properties starting with an underscrore */
    }

    #footer
    {
        color: #999;
        padding: 10px 0;
        text-align: center;
        line-height: normal;
        margin: 0;
        font-size: .9em;
    }

    /* TAB MENU  
    ----------------------------------------------------------*/
    ul#menu
    {
        border-bottom: 1px #5C87B2 solid;
        padding: 0 0 2px;
        position: relative;
        margin: 0;
        text-align: right;
    }

    ul#menu li
    {
        display: inline;
        list-style: none;
    }

    ul#menu li#greeting
    {
        padding: 10px 20px;
        font-weight: bold;
        text-decoration: none;
        line-height: 2.8em;
        color: #fff;
    }

    ul#menu li a
    {
        padding: 10px 20px;
        font-weight: bold;
        text-decoration: none;
        line-height: 2.8em;
        background-color: #e8eef4;
        color: #034af3;
    }

    ul#menu li a:hover
    {
        background-color: #fff;
        text-decoration: none;
    }

    ul#menu li a:active
    {
        background-color: #a6e2a6;
        text-decoration: none;
    }

    ul#menu li.selected a
    {
        background-color: #fff;
        color: #000;
    }

    /* FORM LAYOUT ELEMENTS  
    ----------------------------------------------------------*/

    fieldset
    {
        margin: 1em 0;
        padding: 1em;
        border: 1px solid #CCC;
    }

    fieldset p
    {
        margin: 2px 12px 10px 10px;
    }

    fieldset label
    {
        display: block;
    }

    fieldset label.inline
    {
        display: inline;
    }

    legend
    {
        font-size: 1.1em;
        font-weight: 600;
        padding: 2px 4px 8px 4px;
    }

    input[type="text"]
    {
        200px;
        border: 1px solid #CCC;
    }

    input[type="password"]
    {
        200px;
        border: 1px solid #CCC;
    }

    /* TABLE
    ----------------------------------------------------------*/

    table
    {
      border: solid 1px #e8eef4;
      border-collapse: collapse;
    }

    table td
    {
      padding: 5px;  
      border: solid 1px #e8eef4;
    }

    table th
    {
      padding: 6px 5px;
      text-align: left;
      background-color: #e8eef4;
      border: solid 1px #e8eef4;  
    }

    /* MISC 
    ----------------------------------------------------------*/
    .clear
    {
        clear: both;
    }

    .error
    {
        color:Red;
    }

    #menucontainer
    {
        margin-top:40px;
    }

    div#title
    {
        display:block;
        float:left;
        text-align:left;
    }

    #logindisplay
    {
        font-size:1.1em;
        display:block;
        text-align:right;
        margin:10px;
        color:White;
    }

    #logindisplay a:link
    {
        color: white;
        text-decoration: underline;
    }

    #logindisplay a:visited
    {
        color: white;
        text-decoration: underline;
    }

    #logindisplay a:hover
    {
        color: white;
        text-decoration: none;
    }

    .field-validation-error
    {
        color: #ff0000;
    }

    .input-validation-error
    {
        border: 1px solid #ff0000;
        background-color: #ffeeee;
    }

    .validation-summary-errors
    {
        font-weight: bold;
        color: #ff0000;
    }

  • 相关阅读:
    【json的处理】一、Gson处理
    【校验处理】三、Spring Validation 校验处理
    【校验处理】二、SpringBoot Validate 统一处理
    【校验处理】一、Java Bean Validation验证
    div 固定宽高 水平垂直居中方法
    vue 修改ElementUI样式(非全局修改)
    js --- execCommand('copy')复制文本到剪切板换行符不生效
    C#枚举(一)使用总结以及扩展类分享
    php执行时长
    关于PHP的编码格式导致的乱码
  • 原文地址:https://www.cnblogs.com/sntetwt/p/1983179.html
Copyright © 2011-2022 走看看