天天看點

HTML+CSS大作業:使用html設計一個簡單好看的公司官網首頁 浮動布局

📂文章目錄

  • 一、👨‍🎓網站題目
  • 二、✍️網站描述
  • 三、📚網站介紹
  • 四、🌐網站示範
  • 五、⚙️ 網站代碼
  • 🧱HTML結構代碼
  • 💒CSS樣式代碼
  • 六、🥇 如何讓學習不再盲目
  • 七、🎁更多幹貨

一、👨‍🎓網站題目

👒 公司官網網站 、企業官網、酒店官網、等網站的設計與制作。

二、✍️網站描述

🏷️ 網頁中包含:Div+CSS、滑鼠滑過特效、Table、導航欄效果、banner、表單、二級三級頁面等,視訊音頻元素,同時設計了logo(源檔案),基本期末作業所需的知識點全覆寫。

🏅 一套優質的💯網頁設計應該包含 (具體可根據個人要求而定)

  1. 頁面分為頁頭、菜單導航欄(最好可下拉)、中間内容闆塊、頁腳四大部分。
  2. 所有頁面互相超連結,可到三級頁面,有5-10個頁面組成。
  3. 頁面樣式風格統一布局顯示正常,不錯亂,使用Div+Css技術。
  4. 菜單美觀、醒目,二級菜單可正常彈出與跳轉。
  5. 要有JS特效,如定時切換和手動切換圖檔輪播。
  6. 頁面中有多媒體元素,如gif、視訊、音樂,表單技術的使用。
  7. 頁面清爽、美觀、大方,不雷同。 。
  8. 不僅要能夠把使用者要求的内容呈現出來,還要滿足布局良好、界面美觀、配色優雅、表現形式多樣等要求。

三、📚網站介紹

📔網站布局方面:計劃采用目前主流的、能相容各大主流浏覽器、顯示效果穩定的浮動網頁布局結構。

📓網站程式方面:計劃采用最新的網頁程式設計語言HTML5+CSS3+JS程式語言完成網站的功能設計。并確定網站代碼相容目前市面上所有的主流浏覽器,已達到打開後就能即時看到網站的效果。

📘網站素材方面:計劃收集各大平台好看的圖檔素材,并精挑細選适合網頁風格的圖檔,然後使用PS做出适合網頁尺寸的圖檔。

📒網站檔案方面:網站系統檔案種類包含:html網頁結構檔案、css網頁樣式檔案、js網頁特效檔案、images網頁圖檔檔案;

📙網頁編輯方面:網頁作品代碼簡單,可使用任意HTML編輯軟體(如:​

​Dreamweaver、HBuilder、Vscode 、Sublime 、Webstorm、Text 、Notepad++​

​​ 等任意html編輯軟體進行運作及修改編輯等操作)。

其中:

(1)📜html檔案包含:其中index.html是首頁、其他html為二級頁面;

(2)📑 css檔案包含:css全部頁面樣式,文字滾動, 圖檔放大等;

(3)📄 js檔案包含:js實作動态輪播特效, 表單送出, 點選事件等等(個别網頁中運用到js代碼)。

四、🌐網站示範

HTML+CSS大作業:使用html設計一個簡單好看的公司官網首頁 浮動布局

五、⚙️ 網站代碼

🧱HTML結構代碼

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>首頁</title>
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
    <div class="main">
        <div class="header">
            <div class="header_box">
                <div class="left">
                    <img src="picture/logo.png" alt="">
                </div>
                <div class="right">
                    <div class="top">
                        <span>客服電話:0000-000-000</span>
                        <span>China(中文) |  English(英文)</span>
                    </div>
                    <div class="middle">
                        <input type="text">
                    </div>
                    <div class="bot">           
                        <a href="" class="on">首頁</a>
                        <a href="">企業簡介</a>
                        <a href="">下屬企業</a>
                        <a href="">新聞中心</a>
                        <a href="">主營業務</a>
                        <a href="">企業文化</a>
                        <a href="">企業招聘</a>
                        <a href="">聯系我們</a>
                    </div>
                </div>
            </div>
        </div>
        <div class="banner">
            <img src="picture/banner.jpg" alt="">
        </div>
        <div class="news">
            <div class="new_box">
                <div class="title">
                    <p>新聞中心</p>
                    <p>媒體舉報</p>
                    <p>聯系我們</p>
                </div>
                <div class="new_list">
                    <div class="news_item">
                        <p>
                            <span class="tit">從中國企業企業文化的現實出發...</span>
                            <span class="time">[0000-00-00]</span>
                        </p>
                        <p>
                            <span class="tit">從中國企業企業文化的現實出發...</span>
                            <span class="time">[0000-00-00]</span>
                        </p>
                        <p>
                            <span class="tit">從中國企業企業文化的現實出發...</span>
                            <span class="time">[0000-00-00]</span>
                        </p>
                        <p>
                            <span class="tit">從中國企業企業文化的現實出發...</span>
                            <span class="time">[0000-00-00]</span>
                        </p>
                        <p>
                            <span class="tit">從中國企業企業文化的現實出發...</span>
                            <span class="time">[0000-00-00]</span>
                        </p>
                        <p>
                            <span class="tit">從中國企業企業文化的現實出發...</span>
                            <span class="time">[0000-00-00]</span>
                        </p>
                        <p>
                            <span class="tit">從中國企業企業文化的現實出發...</span>
                            <span class="time">[0000-00-00]</span>
                        </p>
                        <p>
                            <span class="tit">從中國企業企業文化的現實出發...</span>
                            <span class="time">[0000-00-00]</span>
                        </p>
                    </div>
                    <div class="news_item">
                        <div class="new_middle">
                            <div class="tips">
                                111
                            </div>
                            <div class="news_img">
                                <img src="picture/goods1.jpg" alt="">
                            </div>
                            <div class="msg">
                                <p class="tit">
                                    媒體報道
                                </p>
                                <p class="con">報道新聞的内容内容内容内容
                                    内容...[詳情]</p>
                            </div>
                        </div>
                        <div class="new_middle">
                            <div class="tips">
                                111
                            </div>

                            <div class="news_img">
                                <img src="picture/goods1.jpg" alt="">
                            </div>
                            <div class="msg">
                                <p class="tit">
                                    媒體報道
                                </p>
                                <p class="con">報道新聞的内容内容内容内容
                                    内容...[詳情]</p>
                            </div>
                        </div>
                        <div class="new_middle">
                            <div class="tips">
                                111
                            </div>
                            <div class="news_img">
                                <img src="picture/goods1.jpg" alt="">
                            </div>
                            <div class="msg">
                                <p class="tit">
                                    媒體報道
                                </p>
                                <p class="con">報道新聞的内容内容内容内容
                                    内容...[詳情]</p>
                            </div>
                        </div>
                    </div>
                    <div class="news_item">
                        <div class="top_img">
                            <img src="picture/good2.jpg" alt="">
                        </div>
                        <p>服務熱線:0000-000-000</p>
                        <p>企業電話:000-00000000</p>
                        <p>企業位址:xxxxxxxxxxxxxxxx
                            xxxxxx</p>
                    </div>
                </div>
            </div>

        </div>
        <div class="yw">
            <div class="yw_box">
                <div class="title">
                    主營業務
                </div>
                <div class="list">
                    <div class="item">
                        <div class="top_img">
                            <img src="picture/goods3.jpg" alt="">
                        </div>
                        <div class="txt">
                            <span>業務名稱</span>
                            <img src="picture/arrows.jpg" alt="">
                        </div>
                    </div>
                    <div class="item">
                        <div class="top_img">
                            <img src="picture/goods3.jpg" alt="">
                        </div>
                        <div class="txt">
                            <span>業務名稱</span>
                            <img src="picture/arrows.jpg" alt="">
                        </div>
                    </div>
                    <div class="item">
                        <div class="top_img">
                            <img src="picture/goods3.jpg" alt="">
                        </div>
                        <div class="txt">
                            <span>業務名稱</span>
                            <img src="picture/arrows.jpg" alt="">
                        </div>
                    </div>
                    <div class="item">
                        <div class="top_img">
                            <img src="picture/goods3.jpg" alt="">
                        </div>
                        <div class="txt">
                            <span>業務名稱</span>
                            <img src="picture/arrows.jpg" alt="">
                        </div>
                    </div>
                </div>
                <div class="hf">
                    <div class="hf_item">
                        <div class="img">
                            <img src="picture/icon11.jpg" alt="">
                        </div>
                        <div class="txt">
                            <p class="txt1">發展曆程</p>
                            <p class="txt2">蓬勃發展,興旺昌盛</p>
                        </div>
                    </div>
                    <div class="hf_item">
                        <div class="img">
                            <img src="picture/icon22.jpg" alt="">
                        </div>
                        <div class="txt">
                            <p class="txt1">資質榮譽</p>
                            <p class="txt2">重視合作,確定品質,嚴守承諾</p>
                        </div>
                    </div>
                    <div class="hf_item">
                        <div class="img">
                            <img src="picture/icon33.jpg" alt="">
                        </div>
                        <div class="txt">
                            <p class="txt1">媒體報道</p>
                            <p class="txt2">振興民族産業,走在國際前沿</p>
                        </div>
                    </div>
                    <div class="hf_item">
                        <div class="img">
                            <img src="picture/icon44.jpg" alt="">
                        </div>
                        <div class="txt">
                            <p class="txt1">誠聘精英</p>
                            <p class="txt2">有品質有市場,有改善有進步</p>
                        </div>
                    </div>
                </div>
            </div>  
        </div>
        <div class="share">
            <div class="share_box">
                <div class="left">
                    分享:
                    <img src="picture/icon1.jpg" alt="">
                    <img src="picture/icon2.jpg" alt="">
                    <img src="picture/icon3.jpg" alt="">
                    <img src="picture/icon4.jpg" alt="">
                    <img src="picture/icon5.jpg" alt="">
                    <img src="picture/icon6.jpg" alt="">
                </div>
                <div class="right">
                    <input type="text">
                    <span></span>
                </div>
            </div>
        </div>
        <div class="footer">
            <div class="footer_box">
                <div class="item">
                    <p>企業簡介</p>
                    <p>企業簡介</p>
                    <p>企業簡介</p>
                    <p>企業簡介</p>
                    <p>企業簡介</p>
                    <p>企業簡介</p>
                </div>
                <div class="item">
                    <p>下屬企業</p>
                    <p>下屬企業</p>
                    <p>下屬企業</p>
                    <p>下屬企業</p>
                    <p>下屬企業</p>
                    <p>下屬企業</p>
                </div>
                <div class="item">
                    <p>新聞中心</p>
                    <p>新聞中心</p>
                    <p>新聞中心</p>
                    <p>新聞中心</p>
                    <p>新聞中心</p>
                    <p>新聞中心</p>
                </div>
                <div class="item">
                    <p>主營業務</p>
                    <p>主營業務</p>
                    <p>主營業務</p>
                    <p>主營業務</p>
                    <p>主營業務</p>
                    <p>主營業務</p>
                </div>
                <div class="item">
                    <p>企業文化</p>
                    <p>企業文化</p>
                    <p>企業文化</p>

                </div>
                <div class="item">
                    <p>企業招聘</p>
                    <p>企業招聘</p>
                    <p>企業招聘</p>
                </div>
                <div class="item">
                    <p>聯系我們</p>
                    <p>聯系我們</p>
                </div>
            </div>
        </div>
        <div class="footer_bottom">
             <div class="footer_bottom_box">
                 <p>版權所有:xxxx企業名稱    備案号:?icp備00000号</p>
                 <p>服務熱線:0000-000-000</p>
             </div>
        </div>
    </div>
</body>
</html>      

💒CSS樣式代碼

*{
    padding: 0;
    margin: 0;
}
div{
    box-sizing: border-box;
}
img{
    width: 100%;
    height: 100%;
    display: block;
}
a{
    text-decoration: none;
}
.main{
    width: 100%;
    height: 100%;
    background-color: #fff;
}
.main .header{
    width: 100%;
    height: 120px;
}
.main .header .header_box{
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 1320px;
    height: 100%;
    margin: auto;
}
.main .header .header_box .left{
    width: 273px;
    height: 41px;
}
.main .header .header_box .right{
    position: relative;
    height: 100%;
    width: 840px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 0;
}
.main .header .header_box .top{
    text-align: right;
    color: #808080;
    font-size: 16px;
}
.main .header .header_box .middle{
    position: relative;
    width: 220px;
    height: 30px;
    border: 1px solid #0058a6;
    margin-left: 598px;
}
.main .header .header_box .middle::before{
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: block;
    background: url("../image/search.jpg") no-repeat;
    background-size: 100% 100%;
    width: 28px;
    height: 23px;
    -webkit-transform: translateY(-50%);
    -moz-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    -o-transform: translateY(-50%);
}
.main .header .header_box .middle input{
    width: 100%;
    height: 100%;
    border: none;
    background: none;
}
.main .header .header_box .bot{
    display: flex;

    justify-content: flex-end;
}
.main .header .header_box .bot a{
    font-size: 18px;
    color: #4c4c4c;
    margin-left: 40px;
    white-space: nowrap;
    padding-bottom: 8px;
    transition: all .3s;
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -ms-transition: all .3s;
    -o-transition: all .3s;
}
.main .header .header_box .bot a:hover{
    color: #0058a6;
    height: 100%;
    font-weight: bold;
    border-bottom:2px solid #0058a6;
}
.main .header .header_box .bot a.on{
    height: 100%;
    border-bottom: 2px solid #0058a6;
}
.main .banner{
    width: 100%;
}
.main .banner img{
    width: 100%;
    height: auto;
}
.main .news{
    width: 100%;
}
.main .news .new_box{
    width: 1320px;
    margin: 45px auto 0;
}
.main .news .new_box .title{
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #0058a6;
}
.main .news .new_box .title p{
    font-size: 22px;
    color: #000;
    font-weight: bold;
    line-height: 40px;

}
.main .news .new_box .title p:nth-of-type(1),.main .news .new_box .new_list .news_item:nth-of-type(1){
    width: 440px;
}
.main .news .new_box .title p:nth-of-type(2),.main .news .new_box .new_list .news_item:nth-of-type(2){
    width: 480px;
}
.main .news .new_box .title p:nth-of-type(3),.main .news .new_box .new_list .news_item:nth-of-type(3){
    width: 340px;
}
.main .news .new_box .new_list{
    display: flex;
    justify-content: space-between;
}
.main .news .new_box .new_list .news_item:nth-of-type(1) p:hover .tit{
    color: #0058a6;
    font-weight: bold;
}
.main .news .new_box .new_list .news_item:nth-of-type(1) p{
    display: flex;
    justify-content: space-between;
    align-items: center;
    line-height: 32px;
    transition: all .3s;
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -ms-transition: all .3s;
    -o-transition: all .3s;
}
.main .news .new_box .new_list .news_item:nth-of-type(1) p .tit{
    position: relative;
    padding-left: 20px;
    color: #808080;
    font-size: 14px;
}
.main .news .new_box .new_list .news_item:nth-of-type(1) p .tit::before{
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    width: 4px;
    height: 4px;
    background-color: #0058a6;
    -webkit-transform: translateY(-50%);
    -moz-transform: translateY(-50%);
    -ms-transform: translateY(-50%);
    -o-transform: translateY(-50%);
}
.main .news .new_box .new_list .news_item:nth-of-type(1) p .time{
    color: #808080;
    font-size: 14px;
}
.main .news .new_box .new_list .news_item:nth-of-type(2) .new_middle{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 9px;
    transition: all .3s;
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -ms-transition: all .3s;
    -o-transition: all .3s;
}
.main .news .new_box .new_list .news_item:nth-of-type(2) .new_middle:hover .tit{
    color: #0058a6;
}
.main .news .new_box .new_list .news_item:nth-of-type(2) .new_middle:hover img{
    transform: scale(1.1);
    -webkit-transform: scale(1.1);
    -moz-transform: scale(1.1);
    -ms-transform: scale(1.1);
    -o-transform: scale(1.1);
}
.main .news .new_box .new_list .news_item:nth-of-type(2) .new_middle .tips{
    width: 130px;
    height: 73px;
    text-align: center;
    line-height: 73px;
    background: url("../image/itemBg.gif") no-repeat;
    background-size: 100% 100%;
    color: #fff;
    padding-right: 10px;
}
.main .news .new_box .new_list .news_item:nth-of-type(2) .new_middle .news_img{
    width: 106px;
    height: 75px;
    margin: 0 16px 0 16px;
    overflow: hidden;
}
.main .news .new_box .new_list .news_item:nth-of-type(2) .new_middle  .msg{
    height: 75px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 207px;
}
.main .news .new_box .new_list .news_item:nth-of-type(2) .new_middle  .tit{
    color: #4c4c4c;
    font-size: 18px;
    font-weight: bold;
}
.main .news .new_box .new_list .news_item:nth-of-type(2) .new_middle .con{
    color: #4c4c4c;
    font-size: 16px;
}
.main .news .new_box .new_list .news_item:nth-of-type(3) {

}
.main .news .new_box .new_list .news_item:nth-of-type(3) .top_img{
    width: 100%;
    margin-top: 9px;
}
.main .news .new_box .new_list .news_item:nth-of-type(3) P{
    color: #808080;
    font-size: 18px;
    margin-top: 16px;
}
.main .yw{
    width: 100%;
    margin-top: 50px;
}
.main .yw .yw_box .title{
    width: 1320px;
    margin: auto;
    height: 44px;
    line-height: 44px;
    color: #000000;
    font-size: 22px;
    border-bottom: 1px solid   #0058a6;
    margin-bottom: 20px;
}
.main .yw .yw_box {
    width: 1320px;
    margin: auto;
}
.main .yw .yw_box .list{
    display: flex;
    justify-content: space-between;
    width: 1320px;
    margin: auto;
}
.main .yw .yw_box .item{
    width: 310px;
    transition: all .3s;
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -ms-transition: all .3s;
    -o-transition: all .3s;
}
.main .yw .yw_box .item:hover{
    box-shadow: 10px 10px 10px #ddd;
}
.main .yw .yw_box .item:hover img{
    transform: scale(1.1);
    -webkit-transform: scale(1.1);
    -moz-transform: scale(1.1);
    -ms-transform: scale(1.1);
    -o-transform: scale(1.1);
}
.main .yw .yw_box .item .top_img{
    width: 100%;
    overflow: hidden;
}
.main .yw .yw_box .item .txt{
    width: 100%;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    background-color: #f0f0f2;
}
.main .yw .yw_box .item .txt span{
    font-size: 20px;
    font-weight: bold;
}
.main .yw .yw_box .item .txt  img{
    width: 25px;
    height: 25px;

}
.main .yw .yw_box  .hf{
    width: 100%;
    margin: 30px 0;
    display: flex;
    justify-content: space-between;
}
.main .yw .yw_box  .hf .hf_item{
    width: 310px;
    display: flex;
    align-items: center;
}
.main .yw .yw_box  .hf .hf_item:hover .txt1{
    color: #0058a6;
}
.main .yw .yw_box  .hf .hf_item .img{
    width: 60px;
    height: 60px;
}
.main .yw .yw_box  .hf .hf_item .txt{
    margin-left: 20px;
}
.main .yw .yw_box  .hf .hf_item .txt .txt1{
    font-size: 22px;
    font-weight: bold;
}
.main .yw .yw_box  .hf .hf_item .txt .txt2{
    color: #4c4c4c;
    font-size: 16px;
    margin-top: 10px;
}

.main .share{
    width: 100%;
    height: 120px;
    background-color: #e3e3e5;
}
.main .share .share_box{
    width: 1320px;
    margin: auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 22px;
    font-weight: bold;
}
.main .share .share_box .left{
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.main .share .share_box .right{
    position: relative;
    width: 340px;
    height: 40px;
    border: 1px solid   #0058a6;
    background-color: #fff;
}
.main .share .share_box .right span{
    position: absolute;
    top: 0;
    right: 0;
    display: block;
    width: 80px;
    height: 40px;
    border-left: 1px solid #0058a6;
}
.main .share .share_box .right span::before{
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 23px;
    display: block;
    transform: translate(-50%,-50%);
    -webkit-transform: translate(-50%,-50%);
    -moz-transform: translate(-50%,-50%);
    -ms-transform: translate(-50%,-50%);
    -o-transform: translate(-50%,-50%);
    background: url("../image/search.jpg") no-repeat;
    background-size: 100% 100%;
}
.main .share .share_box .right input{
    width: 100%;
    height: 100%;
    border: none;
    background: none;
    padding: 10px;
    box-sizing: border-box;
}
.main .share .share_box img{
    width: 22px;
    height: 22px;
    margin-left: 10px;
}
.main .footer{
    width: 100%;
    height: 325px;
    background-color: #a7a7a7;
}
.main .footer .footer_box{
    width: 1320px;
    margin: auto;
    display: flex;
    padding-top: 50px;
    color: #fefefe;
    justify-content: space-between;
}
.main .footer .footer_box .item p:nth-of-type(1){
   color: #fefefe;
   font-size: 20px;
   font-weight: bold;
   margin-bottom: 30px; 
}
.main .footer .footer_box .item p{
    font-size: 16px;
    margin-bottom: 12px;
}
.main .footer_bottom{
    width: 100%;
    height: 67px;
}
.footer_bottom_box{
    color: #808080;
    font-size: 16px;
    width: 1320px;
    margin: auto;
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}      

六、🥇 如何讓學習不再盲目

第一、帶着目标去學習,無論看書報課還是各種線下活動。

首先要明确自己的學習目标是什麼,是想解決什麼問題,實作怎樣的目标。

第二、學習要建立個人知識體系

知識是學不完的,書籍是浩如煙海的。我們盡情徜徉其中的時候,千萬不要被海水淹死,沒有自我了。在學習過程中,我們會發現每一個知識點都是有她的邊界和背景的,我們要善于歸納整理知識

繼續閱讀