學(xué)習(xí)筆記-CSS-2017.2.18

CSS3 動(dòng)畫(huà)

當(dāng)在 @keyframes 創(chuàng)建動(dòng)畫(huà),把它綁定到一個(gè)選擇器,否則動(dòng)畫(huà)不會(huì)有任何效果。

指定至少這兩個(gè)CSS3的動(dòng)畫(huà)屬性綁定向一個(gè)選擇器:

規(guī)定動(dòng)畫(huà)的名稱(chēng)
規(guī)定動(dòng)畫(huà)的時(shí)長(zhǎng)
<style> 
div
{
    width:100px;
    height:100px;
    background:red;
    animation:myfirst 5s;
    -webkit-animation:myfirst 5s; /* Safari and Chrome */
}

@keyframes myfirst
{
    from {background:red;}
    to {background:yellow;}
}

@-webkit-keyframes myfirst /* Safari and Chrome */
{
    from {background:red;}
    to {background:yellow;}
}
</style>
</head>
<body>

<div></div>

</body>

當(dāng)動(dòng)畫(huà)為 25% 及 50% 時(shí)改變背景色,然后當(dāng)動(dòng)畫(huà) 100% 完成時(shí)再次改變

<style> 
div
{
    width:100px;
    height:100px;
    background:red;
    animation:myfirst 5s;
    -moz-animation:myfirst 5s; /* Firefox */
    -webkit-animation:myfirst 5s; /* Safari and Chrome */
    -o-animation:myfirst 5s; /* Opera */
}

@keyframes myfirst
{
    0%   {background:red;}
    25%  {background:yellow;}
    50%  {background:blue;}
    100% {background:green;}
}

@-moz-keyframes myfirst /* Firefox */
{
    0%   {background:red;}
    25%  {background:yellow;}
    50%  {background:blue;}
    100% {background:green;}
}

@-webkit-keyframes myfirst /* Safari and Chrome */
{
    0%   {background:red;}
    25%  {background:yellow;}
    50%  {background:blue;}
    100% {background:green;}
}

@-o-keyframes myfirst /* Opera */
{
    0%   {background:red;}
    25%  {background:yellow;}
    50%  {background:blue;}
    100% {background:green;}
}
</style>

CSS3 多列

1、將 <div> 元素中的文本分為 3 列:

<style> 
.newspaper
{
    -moz-column-count:3; /* Firefox */
    -webkit-column-count:3; /* Safari and Chrome */
    column-count:3;
}
</style>

2、多列中列與列間的間隙:
column-gap 屬性指定了列與列間的間隙。

<style> 
.newspaper
{
    -moz-column-count:3; /* Firefox */
    -webkit-column-count:3; /* Safari and Chrome */
    column-count:3;

    -moz-column-gap:40px; /* Firefox */
    -webkit-column-gap:40px; /* Safari and Chrome */
    column-gap:40px;
}
</style>

3、列邊框

<style> 
.newspaper
{
    column-count:3;
    column-gap:40px;
    column-rule-style:outset;
    column-rule-width:10px;

    /* Firefox */
    -moz-column-count:3;
    -moz-column-gap:40px;
    -moz-column-rule-style:outset;
    -moz-column-rule-width:10px;

    /* Safari and Chrome */
    -webkit-column-count:3;
    -webkit-column-gap:40px;
    -webkit-column-rule-style:outset;
    -webkit-column-rule-width:1px;
}
</style>

4、指定元素跨越多少列

<style> 
.newspaper
{
    column-count:3;
    -moz-column-count:3; /* Firefox */
    -webkit-column-count:3; /* Safari and Chrome */

}
h2
{
    column-span:all;
    -webkit-column-span:all; /* Safari and Chrome */
}
</style>

5、指定列的寬度

<style> 
.newspaper
{
    column-width:100px;
    -moz-column-width:100px; /* Firefox */
    -webkit-column-width:100px; /* Safari and Chrome */
}
</style>

CSS3 用戶(hù)界面

1、調(diào)整尺寸(Resizing)

<style> 
div
{
    border:2px solid;
    padding:10px 40px; 
    width:300px;
    resize:both;
    overflow:auto;
}
</style>

2、外形修飾(outline-offset )

<style> 
div
{
    margin:20px;
    width:150px; 
    padding:10px;
    height:70px;
    border:2px solid black;
    outline:2px solid red;
    outline-offset:15px;
} 
</style>

3、方框大小調(diào)整(Box Sizing)

<style> 
div.container
{
    width:30em;
    border:1em solid;
}
div.box
{
    box-sizing:border-box;
    -moz-box-sizing:border-box; /* Firefox */
    width:50%;
    border:1em solid red;
    float:left;
}
</style>
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀(guān)點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 選擇qi:是表達(dá)式 標(biāo)簽選擇器 類(lèi)選擇器 屬性選擇器 繼承屬性: color,font,text-align,li...
    wzhiq896閱讀 2,126評(píng)論 0 2
  • 選擇qi:是表達(dá)式 標(biāo)簽選擇器 類(lèi)選擇器 屬性選擇器 繼承屬性: color,font,text-align,li...
    love2013閱讀 2,441評(píng)論 0 11
  • 問(wèn)答題47 /72 常見(jiàn)瀏覽器兼容性問(wèn)題與解決方案? 參考答案 (1)瀏覽器兼容問(wèn)題一:不同瀏覽器的標(biāo)簽?zāi)J(rèn)的外補(bǔ)...
    _Yfling閱讀 14,164評(píng)論 1 92
  • 1.CSS3 邊框 border-radius CSS屬性用來(lái)設(shè)置邊框圓角。當(dāng)使用一個(gè)半徑時(shí)確定一個(gè)圓形;當(dāng)使用兩...
    garble閱讀 781評(píng)論 0 0
  • python以其獨(dú)特的語(yǔ)言風(fēng)格與思想被大家熟知(如下python之禪大家都熟知),本系列主要通過(guò)代碼解讀pytho...
    EldonZhao閱讀 1,052評(píng)論 0 0

友情鏈接更多精彩內(nèi)容