##常用效果css##

來源:互聯網
上載者:User

標籤:splay   nowrap   設計   位置   style   20px   menu   type   dex   

1    絕對位置的元素的位置相對於最近的已定位祖先元素,如果元素沒有已定位的祖先元素,那麼它的位置相對於最初的包含塊。
元素被設定成,absolute,原有的位置會被佔用,設為 relative原位置保留,此時不設定 left,top還是statuc的效果。但可以 對內部的絕對位置起到標準依據效果。 li width:100%  相對於 ul而言;


2    文本換行與不換行 

一般都會使用word-break: keep-all;white-space:nowrap;使得強制不換行。
 word-wrap:break-word;word-break:break-all;white-space:normal; 換行

 

3    table樣式

           <style>        .classical_table1 {            border-collapse: collapse;            border: none; /*這樣設計1px的邊框才能細*/        }             .classical_table1 td {                word-wrap: break-word;                word-break: break-all;                white-space: normal;            }         .classical_table1_top {            padding: 5px 10px;            font-size: 12px;            font-family: Verdana;            font-weight: bold;                        color: #fff;            border-bottom-width: 0;            text-align: center;            border: 1px solid blue;        }             .classical_table1_top td:not(:first-child) {                border-left: 1px solid yellow;            }          /* cont style */        .classical_table1_middle td {            padding: 5px 10px;            font-size: 12px;            font-family: Verdana;            font-weight: bold;            color: #000;            border: 1px solid gray;        }         .classical_table1_bottom td {            background: #eee;            font-family: "Microsoft YaHei";            color: #7a7676;            line-height: 20px;            font-size: 12px;            line-height: 30px;            border: 1px solid gray;        }    </style>



4    帶三角的div css3

忌諱在三角形的父級div使用overflow,如需在可在div裡面嵌套div再裡面的div使用overflow

          /*放內容的div*/    .triangleDiv_cont_div    {        padding: 20px;        overflow: auto;        max-height: 300px;        word-wrap: break-word;        word-break: break-all;        white-space: normal;    }            /*上*/            /*整體div*/    .triangleDiv_UP    {        position: absolute;                border-radius: 4px;        border: 1px solid #545050;        box-shadow: 1px 1px 5px #d1d1d1;        -webkit-box-shadow: 1px 1px 5px gray;    }    .triangleDiv_UP em    {        position: absolute;        left: 10px;        margin-top: -11px;        width: 0;        height: 0;        border-right: 10px solid transparent;        border-left: 10px solid transparent;        border-bottom: 10px solid #1e242b;        z-index: 5;    }    .triangleDiv_UP i    {        position: absolute;        left: 10px;        margin-top: -10px;        width: 0;        height: 0;        border-right: 10px solid transparent;        border-left: 10px solid transparent;        border-bottom: 10px solid white;        z-index: 5;    }            /*下*/    /*整體div*/    .triangleDiv_DOWN    {        position: absolute;                border-radius: 4px;        border: 1px solid #545050;        box-shadow: 1px 1px 5px #d1d1d1;        -webkit-box-shadow: 1px 1px 5px gray;    }    .triangleDiv_DOWN em    {        position: absolute;        left: 10px;        bottom: 0px;        margin-bottom: -11px;        width: 0;        height: 0;        border-right: 10px solid transparent;        border-left: 10px solid transparent;        border-top: 10px solid #1e242b;        z-index: 5;    }    .triangleDiv_DOWN i    {        position: absolute;        left: 10px;        bottom: 0px;        margin-bottom: -10px;        width: 0;        height: 0;        border-right: 10px solid transparent;        border-left: 10px solid transparent;        border-top: 10px solid white;        z-index: 5;    }        /*左*/    /*整體div*/    .triangleDiv_LEFT    {        position: absolute;                border-radius: 4px;        border: 1px solid #545050;        box-shadow: 1px 1px 5px #d1d1d1;        -webkit-box-shadow: 1px 1px 5px gray;    }    .triangleDiv_LEFT em    {        position: absolute;        top: 10px;        margin-left: -11px;        width: 0;        height: 0;        border-top: 10px solid transparent;        border-bottom: 10px solid transparent;        border-right: 10px solid #1e242b;        z-index: 5;    }    .triangleDiv_LEFT i    {        position: absolute;        top: 10px;        margin-left: -10px;        width: 0;        height: 0;        border-top: 10px solid transparent;        border-bottom: 10px solid transparent;        border-right: 10px solid white;        z-index: 5;    }        /*左*/    /*整體div*/    .triangleDiv_RIGHT    {        position: absolute;                border-radius: 4px;        border: 1px solid #545050;        box-shadow: 1px 1px 5px #d1d1d1;        -webkit-box-shadow: 1px 1px 5px gray;    }    .triangleDiv_RIGHT em    {        position: absolute;        top: 10px;        right: 0px;        margin-right: -11px;        width: 0;        height: 0;        border-top: 10px solid transparent;        border-bottom: 10px solid transparent;        border-left: 10px solid #1e242b;        z-index: 5;    }    .triangleDiv_RIGHT i    {        position: absolute;        top: 10px;        right: 0px;        margin-right: -10px;        width: 0;        height: 0;        border-top: 10px solid transparent;        border-bottom: 10px solid transparent;        border-left: 10px solid white;        z-index: 5;    } 



5、向右展開的 ul樣式

 .menu_righttype_ul ul {    top: 0;    left: 100%;} .menu_righttype_ul {    width: 200px;    margin: 0;    padding: 0;    font-family: Segoe UI, Arial;    position: relative;    list-style: none;    box-shadow: 0 1px 2px rgba(0,0,0,0.5);    }     .menu_righttype_ul li {        display: block;        width: 100%;        padding: 0;        font-size: 14px;        position: relative;        box-sizing: border-box;        -moz-box-sizing: border-box;        -webkit-box-sizing: border-box;    }         .menu_righttype_ul li:hover {                    }         .menu_righttype_ul li a {            width: 100%;            display: block;            padding: 15px 20px 15px 19px;            color: #fff6f6;            text-decoration: none;            box-sizing: border-box;            -moz-box-sizing: border-box;            -webkit-box-sizing: border-box;            -o-transition: all .3s ease-in-out;            -webkit-transition: all .3s ease-in-out;            -moz-transition: all .3s ease-in-out;            transition: all .3s ease-in-out;        }     .menu_righttype_ul ul li ul {        top: 1px;    }     .menu_righttype_ul ul, .menu_righttype_ul ul li ul {        list-style: none;        margin: 0;        padding: 0;       /* display: none;*/        position: absolute;        z-index: 999;        width: 100%;        background: #171515;        box-shadow: 0 1px 3px rgba(0,0,0,0.3);    }
//使用
  <ul class="menu_righttype_ul">        <li><a href="javascript:void(0)">多層級</a>            <ul style="display: block;"><li><a href="javascript:void(0)">111111111111111</a></li>                <li><a>111111111111111 </a>                     <ul style="display: block;"><li><a href="javascript:void(0)">522222222222</a></li>                <li><a href="javascript:void(0)">3333333333 </a></li>            </ul>                  </li>            </ul>        </li>     </ul> 





##常用效果css##

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.