最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

基于ccs3的timeline時(shí)間線實(shí)現(xiàn)方法

  發(fā)布時(shí)間:2020-04-30 14:56:38   作者:阿湯筆跡   我要評論
本文提供一種基于CSS3的可逐項(xiàng)展開的timeline,在各展開項(xiàng)中可以嵌入文本、圖片、視頻等元素,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧

在web項(xiàng)目中我們經(jīng)常要使用時(shí)間軸(timeline)控件。本文提供一種基于CSS3的可逐項(xiàng)展開的timeline,在各展開項(xiàng)中可以嵌入文本、圖片、視頻等元素。運(yùn)行效果如下:

實(shí)現(xiàn)

該控件的實(shí)現(xiàn)過程較為簡單,主要由test.html文件和timeline.css文件組成。具體代碼如下:

1、test.html文件

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="timeline.css"/>
    <title>Timeline</title>
</head>
<body>
    <div id='timeDiv'>
        <ul id='timeline'>
          <li class='work'>
            <input class='radio' id='work1' name='works' type='radio' checked>
            <div class="relative">
              <label for='work1'>1、標(biāo)題一</label>
              <span class='date'>T1</span>
              <span class='circle'></span>
            </div>
            <div class='content'>
              <p>
                長安元年(701年),李白,字太白。其生地今一般認(rèn)為是唐劍南道綿州(巴西郡)昌?。ê蟊苄谥M改為昌明)青蓮鄉(xiāng)。祖籍為甘肅天水。
                其家世、家族皆不詳。據(jù)《新唐書》記載,李白為興圣皇帝(涼武昭王李暠)九世孫,按照這個(gè)說法李白與李唐諸王同宗,是唐太宗李世民的同輩族弟。
                亦有說其祖是李建成或李元吉。
              </p>
              <p><img src="http://i.qulishi.com/UploadFile/2014-7/2014725171362.jpg" /></p>
            </div>
          </li>
          <li class='work'>
            <input class='radio' id='work2' name='works' type='radio'>
            <div class="relative">
              <label for='work2'>2、標(biāo)題二</label>
              <span class='date'>T2</span>
              <span class='circle'></span>
            </div>
            <div class='content'>
              <p>
                神龍?jiān)辏?05年), 十一月,武則天去世。李白五歲。發(fā)蒙讀書始于是年。
                《上安州裴長史書》云:“五歲誦六甲。”六甲,唐代的小學(xué)識字課本,長史,州之次官。
              </p>
            </div>
          </li>
          <li class='work'>
            <input class='radio' id='work3' name='works' type='radio'>
            <div class="relative">
              <label for='work3'>3、標(biāo)題三</label>
              <span class='date'>T3</span>
              <span class='circle'></span>
            </div>
            <div class='content'>
              <p>
                開元三年(715年),李白十五歲。
                已有詩賦多首,并得到一些社會名流的推崇與獎掖,開始從事社會干謁活動。
                亦開始接受道家思想的影響,好劍術(shù),喜任俠。是年岑參生。
              </p>
            </div>
          </li>
          <li class='work'>
            <input class='radio' id='work4' name='works' type='radio'>
            <div class="relative">
              <label for='work4'>4、標(biāo)題四</label>
              <span class='date'>T4</span>
              <span class='circle'></span>
            </div>
            <div class='content'>
              <p>
                開元六年(718年),李白十八歲。
                隱居戴天大匡山(在今四川省江油市內(nèi))讀書。
                往來于旁郡,先后出游江油、劍閣、梓州(州治在今四川省境內(nèi))等地,增長了不少閱歷與見識。
              </p>
            </div>
          </li>
        </ul>
        </div>
</body>
</html>

2、timeline.css文件

#timeDiv{
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
    font-size: 100%;
    font-family: "Noto Sans", sans-serif;
    color: black;
    background: white;
}
/* -------------------------------------
* timeline
* ------------------------------------- */
#timeline {
list-style: none;
margin: 50px 0 30px 120px;
padding-left: 30px;
border-left: 8px solid gray;
}
#timeline li {
margin: 40px 0;
position: relative;
}
#timeline p {
margin: 0 0 15px;
}

.date {
margin-top: -10px;
top: 50%;
left: -80px;
font-size: 0.95em;
line-height: 20px;
position: absolute;
}

.circle {
margin-top: -15px;
top: 50%;
left: -49px;
width: 20px;
height: 20px;
background: white;
border: 5px solid gray;
border-radius: 50%;
display: block;
position: absolute;
}

.content {
max-height: 20px;
padding: 70px 20px 0;
border-color: transparent;
border-width: 2px;
border-style: solid;
border-radius: 0.5em;
position: relative;
}
.content:before, .content:after {
content: "";
width: 0;
height: 0;
border: solid transparent;
position: absolute;
pointer-events: none;
right: 100%;
}
.content:before {
border-right-color: inherit;
border-width: 20px;
top: 50%;
margin-top: -20px;
}
.content:after {
border-right-color: white;
border-width: 17px;
top: 50%;
margin-top: -17px;
}
.content p {
max-height: 0;
color: transparent;
text-align: justify;
word-break: break-word;
hyphens: auto;
overflow: hidden;
}
label {
font-size: 1.3em;
position: absolute;
z-index: 100;
cursor: pointer;
top: 35px;
transition: transform 0.2s linear;
font-weight: bold;
}

.radio {
display: none;
}

.radio:checked + .relative label {
cursor: auto;
transform: translateX(42px);
}
.radio:checked + .relative .circle {
background: red;
}
.radio:checked ~ .content {
max-height: 200000px;
border-color: lightgray;
margin-right: 20px;
transform: translateX(20px);
transition: max-height 0.4s linear, border-color 0.5s linear, transform 0.2s linear;
}
.radio:checked ~ .content p {
max-height: 200000px;
color: black;
transition: color 0.3s linear 0.3s;
}
/* -------------------------------------
* mobile phones (vertical version only)
* ------------------------------------- */
@media screen and (max-width: 767px) {
#timeline {
  margin-left: 0;
  padding-left: 0;
  border-left: none;
}
#timeline li {
  margin: 50px 0;
}

label {
  width: 85%;
  font-size: 1.1em;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  display: block;
  transform: translateX(18px);
}

.content {
  padding-top: 60px;
  border-color: #eee9dc;
}
.content:before, .content:after {
  border: solid transparent;
  bottom: 100%;
}
.content:before {
  border-bottom-color: inherit;
  border-width: 17px;
  top: -16px;
  left: 50px;
  margin-left: -17px;
}
.content:after {
  border-bottom-color: white;
  border-width: 20px;
  top: -20px;
  left: 50px;
  margin-left: -20px;
}
.content p {
  font-size: 0.9em;
  line-height: 1.4;
}

.circle, .date {
  display: none;
}
}

【參考文獻(xiàn)】 CSS3 TIMELINE

到此這篇關(guān)于基于ccs3的timeline時(shí)間線實(shí)現(xiàn)方法的文章就介紹到這了,更多相關(guān)css3 timeline實(shí)現(xiàn)內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!

相關(guān)文章

  • CSS3中的字體及相關(guān)屬性詳解

    這篇文章主要介紹了CSS3中的字體及相關(guān)屬性,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2025-06-12
  • CSS3實(shí)現(xiàn)的賬號密碼輸入框提示效果

    本文詳細(xì)解析了CSS3中實(shí)現(xiàn)賬號密碼輸入框提示特效的原理和方法,包括HTML5的placeholder屬性與CSS3新特性如偽類選擇器、動態(tài)效果和過渡動畫的結(jié)合使用,感興趣的朋友跟隨小
    2025-05-14
  • CSS3 布局樣式及其應(yīng)用舉例

    CSS3的布局特性為前端開發(fā)者提供了無限可能,無論是Flexbox的一維布局還是Grid的二維布局,它們都能夠幫助開發(fā)者以更清晰、簡潔的方式實(shí)現(xiàn)復(fù)雜的網(wǎng)頁布局,本文給大家介紹C
    2025-05-14
  • CSS3 Facebook-style Buttons 項(xiàng)目常見問題及最新解決方案

    CSS3 Facebook-style Buttons 是一個(gè)開源項(xiàng)目,旨在通過簡單的 CSS 代碼來重現(xiàn) Facebook 按鈕和工具欄的外觀,本文給大家介紹CSS3 Facebook-style Buttons 項(xiàng)目常見問題及
    2025-05-14
  • 使用animation.css庫快速實(shí)現(xiàn)CSS3旋轉(zhuǎn)動畫效果

    隨著Web技術(shù)的不斷發(fā)展,動畫效果已經(jīng)成為了網(wǎng)頁設(shè)計(jì)中不可或缺的一部分,本文將深入探討animation.css的工作原理,如何使用以及其在實(shí)際項(xiàng)目中的應(yīng)用,感興趣的朋友一起看
    2025-05-14
  • CSS3 最強(qiáng)二維布局系統(tǒng)之Grid 網(wǎng)格布局

    CS3的Grid網(wǎng)格布局是目前最強(qiáng)的二維布局系統(tǒng),可以同時(shí)對列和行進(jìn)行處理,將網(wǎng)頁劃分成一個(gè)個(gè)網(wǎng)格,可以任意組合不同的網(wǎng)格,做出各種各樣的布局,本文介紹CSS3 最強(qiáng)二維布局系
    2025-02-27
  • 如何使用CSS3實(shí)現(xiàn)波浪式圖片墻

    本文介紹了如何使用CSS3的transform屬性和動畫技巧實(shí)現(xiàn)波浪式圖片墻,通過設(shè)置圖片的垂直偏移量,并使用動畫使其周期性地改變位置,可以創(chuàng)建出動態(tài)且具有波浪效果的圖片墻,同
    2025-02-27
  • CSS3模擬實(shí)現(xiàn)一個(gè)雷達(dá)探測掃描動畫特效(最新推薦)

    文章介紹了如何使用CSS3實(shí)現(xiàn)一個(gè)雷達(dá)探測掃描的效果,包括夜色背景、蜘蛛網(wǎng)盤、掃描體的轉(zhuǎn)動效果、尾巴陰影以及被掃描到的光點(diǎn),通過HTML和CSS的配合,實(shí)現(xiàn)了豐富的動畫效果,
    2025-02-21
  • css3 display:flex 彈性盒模型的使用方法

    CSS3的Flexbox是一種強(qiáng)大的布局模式,通過設(shè)置display:flex可以輕松實(shí)現(xiàn)對齊、排列和分布網(wǎng)頁元素,它解決了傳統(tǒng)布局方法中的對齊、間距分配和自適應(yīng)布局等問題,接下來通過本
    2025-02-19
  • css3 實(shí)現(xiàn)icon刷新轉(zhuǎn)動效果

    本文給大家介紹css3 實(shí)現(xiàn)icon刷新轉(zhuǎn)動效果,文章開頭給大家介紹了webkit-transform、animation、@keyframes這三個(gè)屬性,結(jié)合實(shí)例代碼給大家介紹的非常詳細(xì),感興趣的朋友一
    2025-02-19

最新評論

垫江县| 甘泉县| 江川县| 中阳县| 长治市| 曲沃县| 资讯 | 海安县| 隆子县| 鹤庆县| 泸水县| 英超| 嵩明县| 汉寿县| 和顺县| 永城市| 互助| 湛江市| 吐鲁番市| 西青区| 乌审旗| 阿克苏市| 栾城县| 安义县| 斗六市| 称多县| 屏东市| 罗山县| 林芝县| 贵阳市| 楚雄市| 颍上县| 杭锦旗| 长宁县| 长春市| 汪清县| 武威市| 冷水江市| 开平市| 遵义市| 卢龙县|