静态页面学习笔记

一、效果图
在这里插入图片描述
二、HTML代码

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Start-up</title>
</head>
<style>
    header {
        background-position: -42px 0px;
        background-image: url("./images/header-bg.jpg");
        align-items: center;
        box-sizing: border-box;
        background-repeat: no-repeat;
    }
</style>

<body>
    <!-- 头部区域 -->
    <header>
        <div class="navFirst"></div>
        <div class="topTitle"></div>
        <div class="topTitle"></div>
        <div class="topTitle"></div>
        <div class="topTitle"></div>
        <div class="topTitle"></div>
    </header>
    <!-- 思考大图 -->
    <section class="thinking">
        <span class="write">Here We</span>
        <span class="write write2"> Are!</span>
        <p class="thinkWord"></p>
        <!-- 黄色五角星,白色五角星 -->
        <p>
            <span class="fivePointerStart"></span>
            <span class="fivePointerStart"></span>
            <span class="fivePointerStart"></span>
        </p>
    </section>
    <!-- who were are 区域 -->
    <section class="whoWeAre">
        <!-- 左侧 -->
        <figure>
            <img src="" alt="" class="messagePic">
            <figcaption></figcaption>
        </figure>
        <!-- 右侧 -->
        <figure>
            <img src="" alt="" class="messagePic">
            <figcaption></figcaption>
        </figure>
    </section>
    <!-- 欢迎光临区域 -->
    <SECtion class="welcome"></SECtion>
    <!-- 脚部区域 -->
    <footer>
        <section class="footerSec">
            <p style="font-style:italic;font-size: 28px; margin-top: 40px; margin-bottom: 20px;"> our Ideas</p>
            <div style="display: flex; justify-content: space-between; box-sizing: border-box;">
                <img src="./images/page1-img3.jpg" alt="" class="needBorder">
                <img src="./images/page1-img4.jpg" alt="" class="needBorder">
                <img src="./images/page1-img5.jpg" alt="" class="needBorder">
            </div>
            <div style="display: flex;justify-content: space-between;">
                <span style="font-size: 18px; color: #fb9051; margin-top: 25px;">Nam liber tempor</span>
                <span style="font-size: 18px; color: #fb9051; margin-top: 25px;"> Cum Solute nobis</span>
                <span style="font-size: 18px; color: #fb9051; margin-top: 25px;"> Eleifend optiongue</span>
            </div>
            <div style="display: flex;justify-content: space-evenly;">
                <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Impedit </p>
                <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Impedit </p>
                <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Impedit </p>
            </div>
            <div style="display: flex; align-items: center; font-size: 20px;">
                <img src="./images/button.png" alt="">
                <span  style="cursor: pointer;">Read More</span>
            </div>
        </section>
        <!-- 右侧区域设置 -->
        <section class="footerSec" style="margin-left: 50px;">
            <p style="font-size: 24px;">Latest Events</p>
            <p style="display: flex;align-items: center; position: relative; ">
                <img src="./images/date.png" alt=""><span style="position: absolute; left:18px; top:20px;">29</span>
                <span style="font-size: 18px;">May,2012</span>
            </p>
            <p style="font-size: 10px; color: #fb9051;">Lorem ipsum dolor sit amet consect.</p>
            <p style="font-size: 10px;">Lorem ipsum dolor sit amet consect.</p>
            <p style="font-size: 10px; ">Lorem ipsum dolor sit amet consect.</p>
            <p style="display: flex;align-items: center; position: relative; ">
                <img src="./images/date.png" alt=""><span style="position: absolute; left: 18px; top:20px">21</span>
                <span style="font-size: 18px;">May,2012</span>
            </p>
            <p style="font-size: 10px; color: #fb9051;">Lorem ipsum dolor sit amet consect.</p>
            <p style="font-size: 10px;">Lorem ipsum dolor sit amet consect.</p>
            <p style="font-size: 10px; ">Lorem ipsum dolor sit amet consect.</p>
            <div style="display: flex; align-items: center; font-size: 20px;">
                <img src="./images/button.png" alt="">
                <span  style="cursor: pointer;">Read More</span>
            </div>
        </section>
        
    </footer>

    <script src="./index.js"></script>
</body>

</html>

三、js代码

let headerEle = document.getElementsByTagName("header")[0];

//设置头部样式
Object.assign(headerEle.style, {
    width: 1200 + "px",
    height: 90 + "px",
    margin: "0 auto",
    backgroundImage: `url("./images/header-bg.jpg")`,
    backgroundSize: "100% 100%",
    display: "flex",
    alignItems: "center",
    boxSizing: "border-box",
    paddingLeft: "165px"
})

//  头部左侧图标设置
let navFirst = document.getElementsByClassName("navFirst")[0];
Object.assign(navFirst.style, {
    width: 187 + "px",
    height: 56 + "px",
    backgroundImage: `url("./images/logo.png")`,
    backgroundSize: "100% 100%",
    display: "flxe"
});
//  2 3 4 5 6 文字添加。
let topTitle = [...document.getElementsByClassName("topTitle")];
topTitle.map(item => Object.assign(item.style, {
    fontSize: "20px",
    marginRight: "45px",
    color: "#e3e3e3",
   fontStyle :"italic"
}));
topTitle[0].innerHTML = "Home";
topTitle[0].style.marginLeft = "200px";
topTitle[0].style.color = "#cf7a0d"
topTitle[1].innerHTML = "About";
topTitle[2].innerHTML = "Services";
topTitle[3].innerHTML = "Products";
topTitle[4].innerHTML = "Contacts";

// 思考大图及其文字添加。——思考区域设置相对绝对定位进行操作
// 496px
let thinking = document.getElementsByClassName("thinking")[0];
Object.assign(thinking.style, {
    width: 1200 + "px",
    height: 496 + "px",
    margin: "0 auto",
    backgroundImage: `url("./images/slider-1.jpg")`,
    backgroundRepeat: "no-repeat",
    position: "relative"
});

let write = [...document.getElementsByClassName("write")];
write[0].style.position = "absolute";
write[0].style.top = "100px";
write[0].style.fontSize = "42px";
write[0].style.right = "190px";
write[0].style.fontStyle = "italic";

write[1].style.position = "absolute";
write[1].style.top = "142px";
write[1].style.fontSize = "42px";
write[1].style.right = "270px";
write[1].style.fontStyle = "italic";

let thinkWord = document.getElementsByClassName("thinkWord")[0];
Object.assign(thinkWord.style, {
    width: 280 + "px",
    height: "auto",
    position: "absolute",
    top: "220px",
    left: "750px"
});
thinkWord.innerHTML = "Duis autem vel eum iriure dolor in hendreit in vulputate velit esse molestie consequat";
thinkWord.style.lineHeight = "40px";
thinkWord.style.fontSize = "18px";
thinkWord.style.fontStyle = "italic";
// 五角星
let fivePointerStart = [...document.getElementsByClassName("fivePointerStart")];
// 通用样式样式设置
fivePointerStart.map(item => Object.assign(item.style, {
    position: "absolute",
    display: "inline-block",
    width: "34px",
    height: "34px",
    top: "375px",
    left: "800px",
    backgroundImage: `url("./images/pagination.png")`
}));
fivePointerStart[0].style.backgroundPosition=`-45px 0px`;
fivePointerStart[1].style.left=`845px`;
fivePointerStart[2].style.left=`890px`;
fivePointerStart[2].style.backgroundPosition=`-45px 0px`;

// whoWeAre区域设置
let whoWeAre=document.getElementsByClassName("whoWeAre")[0];

Object.assign(whoWeAre.style,{
    width:"1200px",
    boxSizing:"border-box",
    paddingLeft:"160px",
    paddingRight:"160px",
    backgroundColor:"#f6f6f6",
    height:"210px",
    margin:"0 auto",
    borderBottom:"1px dashed black",
    boxSizing:"border-box",
    display:"flex"
});



// 获取figure区域
let figureEle=[...document.getElementsByTagName("figure")];
figureEle.map(item=>item.style.width="480px");
figureEle.map(item=>item.style.height="210px");
figureEle.map(item=>item.style.display="flex");
figureEle.map(item=>item.style.margin="0");
figureEle.map(item=>item.style.padding="0");
figureEle.map(item=>item.style.marginTop="50px");
// 文字相关描述
let figcaptionEle=[...document.getElementsByTagName("figcaption")];
figcaptionEle.map(item=>item.style.margin="0px")
figcaptionEle[0].innerHTML=`
<p style="font-size:24px; font-style:italic;">Who We are</p>
<P  style="font-size: 12px; line-height:20px; font-style:italic">Start-Up is one of <i  style="color:#ff9000">free website</i> templates created by
TemplateMonster.com team.its optimized for 1280*1024 screen resolution
</P>
`
// 图片
let figurePicture=[...document.getElementsByClassName("messagePic")];
figurePicture[0].setAttribute("src","./images/page1-img1.png");
figurePicture[0].style.width="140px";
figurePicture[0].style.height="136px";

// 右侧设置
figcaptionEle[1].innerHTML=`
<p style="font-size:24px; font-style:italic;">Starting Up...</p>
<P  style="font-size: 12px; line-height:20px; font-style:italic">Start-Up is one of <i  style="color:#ff9000">free website</i> templates created by
TemplateMonster.com team.its optimized for 1280*1024 screen resolution
</P>
`
// 图片
figurePicture[1].setAttribute("src","./images/page1-img2.png");
figurePicture[1].style.width="140px";
figurePicture[1].style.height="136px";

// 欢迎区域设置
let welcomeEle=document.getElementsByClassName("welcome")[0];
Object.assign(welcomeEle.style,{
    width:"1200px",
    height:"138px",
    boxSizing:"border-box",
    paddingLeft:"160px",
    paddingRight:"160px",
    backgroundColor:"#f6f6f6",
    margin:"0 auto",
    borderBottom:"1px dashed black",
    paddingTop:"30px",
    paddingBottom:"40px"
});
// 文字内容添加
welcomeEle.innerHTML=`
<p style="font-size:36px; font-style:italic;  margin:0px ">Welcome TO Our <span  style="color:#ff9000">Start-UP</span>Website!</p>
<p style="font-size:22px; font-style:italic; margin:0px">Duis autem veleum iriure dolor in hendrerit in vulputate velit esse</p>
`;
// 脚部区域设置
let footerEle=document.getElementsByTagName("footer")[0];
footerEle.style.width="1200px";
footerEle.style.height="440px";
footerEle.style.margin="0 auto";
footerEle.style.backgroundColor="#f2f2f2";
footerEle.style.paddingLeft="160px";
footerEle.style.paddingRight="160px";
footerEle.style.boxSizing="border-box";
footerEle.style.display="flex";
// 脚部区域sect获取
let footerSec=[...document.getElementsByClassName("footerSec")];

footerSec[0].style.width="594px";
footerSec[0].style.height="100%";
let needBorder=[...document.getElementsByClassName("needBorder")];
needBorder.map(item=>item.style.border="10px solid white");
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值