2019-07-28 css07 19到32

代碼

    <link rel="stylesheet" href="css/style.css">
    <title>Title</title>
</head>
<body>
<nav>
    <ul>
        <li><img src="images/t1.jpg" width="126px" height="86px" alt=""></li>
        <li><img src="images/t2.jpg" width="126px" height="86px" alt=""></li>
        <li><img src="images/t3.jpg" width="126px" height="86px" alt=""></li>
        <li><img src="images/t4.jpg" width="126px" height="86px" alt=""></li>
        <li><img src="images/t5.jpg" width="126px" height="86px" alt=""></li>
        <li><img src="images/t6.jpg" width="126px" height="86px" alt=""></li>
        <li><img src="images/t7.jpg" width="126px" height="86px" alt=""></li>
        <li><img src="images/t1.jpg" width="126px" height="86px" alt=""></li>
        <li><img src="images/t2.jpg" width="126px" height="86px" alt=""></li>
        <li><img src="images/t3.jpg" width="126px" height="86px" alt=""></li>
        <li><img src="images/t4.jpg" width="126px" height="86px" alt=""></li>
        <li><img src="images/t5.jpg" width="126px" height="86px" alt=""></li>
        <li><img src="images/t6.jpg" width="126px" height="86px" alt=""></li>
        <li><img src="images/t7.jpg" width="126px" height="86px" alt=""></li>
    </ul>
</nav>




* {
    margin: 0;
    padding: 0;
}
ul {
    list-style: none;
}
nav {
    width: 882px;
    height: 86px;
    border: 1px solid pink;
    margin: 100px auto;
    overflow: hidden;
}
nav li {
    float:left;
}
nav ul {
    width: 200%;
    animation: moveing 5s linear infinite;/*引用動畫*/
    /*linear 勻速運動*/
}
    /*定義動畫*/
@keyframes moveing {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-882px);
    }
}
nav:hover ul {/*鼠標經(jīng)過nav 里面的 ul 就不做動畫了*/
    animation-play-state: paused;/*鼠標經(jīng)過暫停動畫*/
}



結(jié)果

image.png

代碼

    <link rel="stylesheet" href="css/style.css">
    <title>傳統(tǒng)布局三等份</title>
</head>
<body>
<section>
    <div>1</div>
    <div>2</div>
    <div>3</div>
</section>


section {
    width: 80%;
    height: 200px;
    border: 1px solid pink;
    margin: 100px auto;
}
section div {
    width: 33.33%;
    height: 100%;
    float: left;
}
section div:nth-child(1) {
    background-color: pink;
}
section div:nth-child(2) {
    background-color: purple;
}
section div:nth-child(3) {
    background-color: blue;
}


結(jié)果

image.png

代碼

    <link rel="stylesheet" href="css/style.css">
    <title>伸縮布局三等份</title>
</head>
<body>
<section>
    <div>1</div>
    <div>2</div>
    <div>3</div>
</section>




section {
    width: 80%;
    height: 200px;
    border: 1px solid pink;
    margin: 100px auto;
    /*父級盒子添加flex*/
    display: flex;/*伸縮布局模式*/
}
section div {

    height: 100%;
    /*flex: 1;子盒子添加份數(shù)*/
    /*margin: 0 5px;*/
}
section div:nth-child(1) {
    background-color: pink;
    flex: 1;/*flex: 1 子盒子份數(shù)当叭,不跟單位*/
}
section div:nth-child(2) {
    background-color: purple;
    flex: 2;
}
section div:nth-child(3) {
    background-color: blue;
    flex: 1;
}



結(jié)果

image.png

代碼

    <link rel="stylesheet" href="css/style.css">
    <title>伸縮布局固定寬度</title>
</head>
<body>
<section>
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>
</section>




section {
    width: 80%;
    height: 200px;
    border: 1px solid pink;
    margin: 100px auto;
    /*父級盒子添加flex*/
    display: flex;/*伸縮布局模式*/
    min-width: 500px;
    flex-direction: column;/*給父盒子添加 伸縮布局排列方式 垂直聚磺,row水平也可以*/
}
section div {

    height: 100%;

}
section div:nth-child(1) {
    background-color: pink;
    /*width: 200px;*/
}
section div:nth-child(2) {
    background-color: purple;
    /*margin: 0 5px;*/
    /*width: 100px;*/
}
section div:nth-child(3) {
    background-color: blue;
    /*flex: 1;*/
}
section div:nth-child(4) {
    background-color: green;
    /*flex: 1;*/
}


結(jié)果

image.png

代碼

    <link rel="stylesheet" href="css/style.css">
    <title>攜程旅行</title>
</head>
<body>
    <header>
        <img src="images/baodi2@v7.15.jpg" width="768px" height="154px" >
    </header>
<nav>
    <div class="row">
        <div class="rou3 hote"><a href="#">酒店</a></div>
        <div class="rou3  hotel">
            <a href="#">海外酒店</a>
            <a href="#">特價酒店</a>
        </div>
        <div class="rou3  hotel">
            <a href="#">團購</a>
            <a href="#">民宿·客棧</a>
        </div>
    </div>
    <div class="row">
        <div class="rou3 hote"><a href="#">機票</a></div>
        <div class="rou3  hotel">
            <a href="#">火車票·搶票</a>
            <a href="#">特價機票</a>
        </div>
        <div class="rou3  hotel">
            <a href="#">汽車票·船票</a>
            <a href="#">專車·租車</a>
        </div>
    </div>
    <div class="row">
        <div class="rou3 hote"><a href="#">旅游</a></div>
        <div class="rou3  hotel">
            <a href="#">目的地攻略</a>
            <a href="#">周邊游</a>
        </div>
        <div class="rou3  hotel">
            <a href="#">郵輪旅行</a>
            <a href="#">定制旅行</a>
        </div>
    </div>
    <div class="row">
        <div class="rou3  hotel">
            <a href="#">景點·玩樂</a>
            <a href="#">禮品卡</a>
        </div>
        <div class="rou3  hotel">
            <a href="#">美食林</a>
            <a href="#">Wifi·電話卡</a>
        </div>
        <div class="rou3  hotel">
            <a href="#">購物·外匯</a>
            <a href="#">保險·簽證</a>
        </div>
    </div>

</nav>
</body>


* {
    margin: 0;
    padding: 0;
}
ul {
    list-style: none;
}
body {
    min-width: 320px;/*最小寬度*/
    max-width: 540px;/*最大寬度*/
    margin: 0 auto;
}
header {
    width: 100%;/*繼承body的寬度 body 540px*/
    height: 100px;
}
header img {
    width: 100%;/*繼承header的寬度*/
    height: 100%;
}
nav {
    padding: 5px;
}
.row {
    height: 90px;
    width: 100%;
    background-color: pink;
    border-radius: 8px;
    display: flex;/*伸縮布局 父親加*/
    margin-bottom: 5px;
}
nav .row:nth-child(2) {
    background-color: #3d98ff;
}
nav .row:nth-child(3) {
    background-color: #44c522;
}
nav .row:nth-child(4) {
    background-color: #fc9720;
}
.rou3 {
    flex: 1;/*每個占一份*/
    border-left: 1px solid #ffffff;
}
.row div:first-child {
    border: 0;
}
.hotel {
    display: flex;
    flex-direction: column;/*垂直排列*/
}
.hotel a {

    flex: 1;
    font-size: 16px;
    color:#ffffff;
    text-align: center;
    line-height: 45px;
    text-decoration: none;
    text-shadow: 0 2px 1px rgba(0, 0, 0, 0.5);/*文字陰影*/
}
.hotel a:first-child {
    border-bottom: 1px solid #ffffff;
}
.hote a{
    flex: 1;
    font-size: 16px;
    color:#ffffff;
    text-align: center;
    line-height: 90px;
    text-decoration: none;
    text-shadow: 0 2px 1px rgba(0, 0, 0, 0.5);/*文字陰影*/;
}




結(jié)果

image.png
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末鞠柄,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子计露,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 212,599評論 6 492
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件阻课,死亡現(xiàn)場離奇詭異扳剿,居然都是意外死亡旁趟,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,629評論 3 385
  • 文/潘曉璐 我一進店門舞终,熙熙樓的掌柜王于貴愁眉苦臉地迎上來轻庆,“玉大人,你說我怎么就攤上這事敛劝∮啾” “怎么了勒魔?”我有些...
    開封第一講書人閱讀 158,084評論 0 348
  • 文/不壞的土叔 我叫張陵衅檀,是天一觀的道長。 經(jīng)常有香客問我抚官,道長,這世上最難降的妖魔是什么桩砰? 我笑而不...
    開封第一講書人閱讀 56,708評論 1 284
  • 正文 為了忘掉前任拓春,我火速辦了婚禮,結(jié)果婚禮上亚隅,老公的妹妹穿的比我還像新娘硼莽。我一直安慰自己,他們只是感情好煮纵,可當我...
    茶點故事閱讀 65,813評論 6 386
  • 文/花漫 我一把揭開白布懂鸵。 她就那樣靜靜地躺著,像睡著了一般行疏。 火紅的嫁衣襯著肌膚如雪匆光。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 50,021評論 1 291
  • 那天酿联,我揣著相機與錄音终息,去河邊找鬼。 笑死贞让,一個胖子當著我的面吹牛周崭,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播喳张,決...
    沈念sama閱讀 39,120評論 3 410
  • 文/蒼蘭香墨 我猛地睜開眼休傍,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了蹲姐?” 一聲冷哼從身側(cè)響起磨取,我...
    開封第一講書人閱讀 37,866評論 0 268
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎柴墩,沒想到半個月后忙厌,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 44,308評論 1 303
  • 正文 獨居荒郊野嶺守林人離奇死亡江咳,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,633評論 2 327
  • 正文 我和宋清朗相戀三年逢净,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片歼指。...
    茶點故事閱讀 38,768評論 1 341
  • 序言:一個原本活蹦亂跳的男人離奇死亡爹土,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出踩身,到底是詐尸還是另有隱情胀茵,我是刑警寧澤,帶...
    沈念sama閱讀 34,461評論 4 333
  • 正文 年R本政府宣布挟阻,位于F島的核電站琼娘,受9級特大地震影響峭弟,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜脱拼,卻給世界環(huán)境...
    茶點故事閱讀 40,094評論 3 317
  • 文/蒙蒙 一瞒瘸、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧熄浓,春花似錦情臭、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,850評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至惯雳,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間鸿摇,已是汗流浹背石景。 一陣腳步聲響...
    開封第一講書人閱讀 32,082評論 1 267
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留拙吉,地道東北人潮孽。 一個月前我還...
    沈念sama閱讀 46,571評論 2 362
  • 正文 我出身青樓,卻偏偏與公主長得像筷黔,于是被迫代替她去往敵國和親往史。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 43,666評論 2 350

推薦閱讀更多精彩內(nèi)容