我应该从哪里开始让这个网页响应?
P粉477369269
P粉477369269 2024-04-04 21:21:25
0
1
578

<!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">
    <link rel="stylesheet" href="css\home.css">
    <title>Welcome</title>
</head>
<body>
    <nav>
        <div class="nav-brand">
            <img  src="\images\Yummy Cookies-logos_black.png" alt="">
        </div>
        <ol>
            <li><a href="">Home</a></li>
            <li><a href="">Our Journey</a></li>
            <li><a href="">Place Your Order</a></li>
            <li><a href="">About</a></li>

        </ol>
    </nav>
    <section class="video-greeting">
        
        <video autoplay loop muted src="videos\pexels-olya-kobruseva-5264841.mp4"> </video>
        
       <a href="">Place Your Order</a>



        
       
        
    </section>

    <section class="cookie-tab">
        <img class="first-image"width=300px src="images\delish-ms-fields-cookies-024-1544735513.jpg" alt="">
        <p class="first-lorem">Lorem ipsum dolor sit amet consectetur adipisicing elit. Consectetur mollitia, voluptates laudantium adipisci deserunt consequuntur sequi assumenda veritatis quaerat id asperiores saepe est. Unde magnam dolores rem, neque tempora perspiciatis.</p>
        
       
        <p class="second-lorem">Lorem ipsum, dolor sit amet consectetur adipisicing elit. Ea, quibusdam est facere, alias rem perferendis animi, architecto nobis at iste aliquam quis adipisci error? Itaque porro quam odit est laboriosam obcaecati soluta sapiente earum quas rerum, tempora magni excepturi maiores saepe aperiam ipsum eaque quasi libero vero corrupti dolorum dolor! Vero magni recusandae cum nesciunt aliquam quo debitis placeat eos reprehenderit harum repellendus, dolore rerum doloribus, accusamus, aliquid corporis laborum praesentium molestias neque porro magnam. Quam corrupti delectus provident cum vitae sed earum nihil nemo. Cupiditate ab, voluptate aspernatur ullam libero dolorum animi qui nisi eaque impedit, a tempora veniam.</p>
         <img class="second-image"width=300px src="\images\soft-sugar-cookies-5.jpg" alt="">
    </section>

    
    
</body>
</html>

@import url('https://fonts.googleapis.com/css2?family=Cookie&display=swap');


body{
    font-family: 'Cookie', cursive;
    margin: 0px;
    box-sizing: border-box;
}

/* navbar ________________ */
nav{

    background-color: pink;
    position: fixed;
    z-index: 12;
    width: 100%;
    top: 0px;
    display: flex;
    justify-content: space-between;
    max-height: 120px;

    
    
    



}

.nav-brand{

width: 100px;
display: inline-block;
}

.nav-brand img{
    width: 100%;
    
}

nav ol{

    display: flex;
    gap: 5px;

    
   
    margin-right: 20px











}

nav li{
    display: inline-block;
    list-style: none;
    
    

    
    

    
    
}

nav li a{
    display: inline-block;
    text-decoration: none;
    color: black;
    font-size: 1em;
    padding:2px;
    padding-top: 30px;
    
    
    
    

}

nav li a:hover{
    color: white;
}


/* video greeting */


.video-greeting{
    margin-top: 90px;
    background-color: pink;
    width: 100%;
    height: 400px;
    
    


}




.video-greeting video {
    width: 100%;
    height: 100%;
    position: relative;

    object-fit: cover;

    


    left: 50%;
    transform: translateX(-50%);
}

.video-greeting a {

    position: absolute;
    z-index: 2;
    font-size: 1em;
    background-color: pink;
    background-color: rgba(251, 231, 239, 1);

    padding: 10px;
    border-radius: 50%;

    top: 43%;
    left: 39%;
    
    text-decoration: none;
    color: black;
    
    

}


.cookie-tab{

  
    background-color: pink;
    padding: 20px 10px;
    display: grid;
    
    grid-template-columns: auto auto;
    gap: 20px;
    
    

}

.cookie-tab img{
    
    border: 2px black solid;
    width: 100%;
    
    
    display: block;

    
}

.cookie-tab p{
    width: 100%;
    display: inline-block;
    text-align: center;
   
    

}

我想让这个页面更具响应性我知道我可以使用@media工具,但我想知道是否有更好的方法来改变单位类型。比如如何随着页面尺寸的增加而缩放字体,或者如何使某些元素(例如视频问候元素)不移动而停留在一个地方。谢谢

P粉477369269
P粉477369269

全部回复(1)
P粉401527045

此代码适用于较小的设备。使用它作为起点

@media only screen and (max-width: 600px) {
  .nav {
     flex-direction: column;
  }
}

基本上样式将应用在此宽度或更小的宽度

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板