элемент div имеет неправильный видовой экран - PullRequest
0 голосов
/ 30 сентября 2019

Вот так выглядит страница на обычном компьютере:

https://i.imagesup.co/images2/83d44ebd26a8d65586a8dca77544d6ae04f47241.png

И это проблема в мобильной версии: когда я пытаюсь установить div witdh на 100 precent или 100vwили расположите этот элемент, как будто он не соответствует реальному началу (справа), и элемент думает, что начало находится где-то посередине. Я говорю о второй белой коробке («AboutWhite»). Здесь вы можете увидеть, как это выглядит: https://i.imagesup.co/images2/af732e6868a68765a8abafdadce0ab5049506e4a.png

Почему он отличается от первого белого поля?

Большое спасибо за помощь !!!

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">
    <title>HomePage</title>
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="hover.css">
    <link rel="stylesheet" href="WhiteBox.css">
    <link rel="stylesheet" href="mobile.css">
    <link href="https://fonts.googleapis.com/css?family=M+PLUS+Rounded+1c&display=swap" rel="stylesheet">
</head>
<body>
 <header>
    <img class="img-center" id="img-main" src="http://thestarsetsociety.org/wp-content/uploads/2019/09/assasn-14li-banner-800x300.jpg" alt="E=MC^2"/>
    <img class="img-center" id="img-below" src="https://thumbor.forbes.com/thumbor/960x0/https%3A%2F%2Fblogs-images.forbes.com%2Frainerzitelmann%2Ffiles%2F2019%2F06%2FE0MG76-e1560965378507-1200x1270.jpg" alt="Albert"/>
    <h1>אלברט איינשטיין</h1>
    <h2>פיזיקאי תיאורטי</h2>
   <div id="DivIcons">
     <div id="flex-mobile1">
    <a href="tel:+4917640206387" target="_blank"><img id="MobileHover" class="icons" src="https://cdn2.iconfinder.com/data/icons/thin-line-color-1/21/13-512.png" alt="Moblie Icon"></a>
    <a href="https://www.whatsapp.com/" target="_blank"><img class="icons" src="https://img.icons8.com/ultraviolet/452/whatsapp.png" alt="What'sapp Icon"></a>
    <a href="https://www.instagram.com/" target="_blank"><img class="icons" src="https://www.trzcacak.rs/myfile/full/311-3111799_social-media-computer-icons-logo-blue-area-png.png" alt="Instagram Icon"></a>
   </div>
   <div id="flex-mobile2">
    <a href="https://mail.google.com/mail/u/0/#inbox" target="_blank"><img class="icons" src="https://cdn2.iconfinder.com/data/icons/basic-thin-line-color/21/20-512.png" alt="Email Icon"></a>
    <a href="https://he-il.facebook.com/" target="_blank"><img class="icons" src="https://thebrightwork.com/wp-content/uploads/2014/04/facebook-icon-blue.png" alt="Facebook Icon"></a>
    <a href="https://www.waze.com/he/livemap" target="_blank"><img class="icons" src="https://cdn4.iconfinder.com/data/icons/social-media-logos-6/512/10-waze-512.png" alt="Waze Icon"></a>
    </div> 
  </div>

   <div id="FirstWhite"></div> <!--Only for Design - White Box-->



 </header>

<article>
  <h3>
    קצת עלי
  </h3>
  <b>
  <p>
      לורם איפסום דולור סיט אמט, קונסקטורר אדיפיסינג אלית. סת אלמנקום ניסי נון ניבאה. דס איאקוליס וולופטה דיאם. וסטיבולום אט דולור, קראס אגת לקטוס וואל אאוגו וסטיבולום סוליסי טידום בעליק. 
  </p>
  </b>
  <p>
      לורם איפסום דולור סיט אמט, קונסקטורר אדיפיסינג אלית. סת אלמנקום ניסי נון ניבאה. דס איאקוליס וולופטה דיאם. וסטיבולום אט דולור, קראס אגת לקטוס וואל אאוגו וסטיבולום סוליסי טידום בעליק. 
  </p>
  <p>
      לורם איפסום דולור סיט אמט, קונסקטורר אדיפיסינג אלית. סת אלמנקום ניסי נון ניבאה. דס איאקוליס וולופטה דיאם. וסטיבולום אט דולור, קראס אגת לקטוס וואל אאוגו וסטיבולום סוליסי טידום בעליק. 
  </p>
</article>
<div id="AboutWhite"></div> <!--Only for Design - White Box-->



</body>
</html>

Css стиль:

body {
    margin: auto 0;
    direction: rtl;
    background-color:#F0F0F0;
}

.img-center {
    display: block;
    margin: 0 auto;

}

#img-below {
    border: 5px solid white;
    border-radius: 100%;
    height: 8%; 
    width: 8%;
    position: relative;
    bottom: 80px;
}

h1 {
    color:#0099ff;
    text-align: center;
    position: relative;
    bottom:  120px;
    font-size: 50px;
    font-family: 'M PLUS Rounded 1c', sans-serif;
}

h2 {
    color: gray;
    font-size: 30px;
    text-align: center;
    font-size: 30px;
    position: relative;
    bottom: 157px;
    font-family: 'M PLUS Rounded 1c', sans-serif;

}

.icons {
    height: 50px;
    width: 50px;
    border: #0099ff 5px solid;
    padding: 5px;
    border-radius: 100%;;
    margin-right: 15px;
}

#DivIcons {
    display: flex;
    flex-direction: row;
    justify-content: center;
    position: relative;
    bottom: 170px;
}

p {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    font-size: 15px;


}

article {
    width: 160px;
    margin-bottom: 5px;
    position: relative;
    bottom: 455px;
    right: 397px;
}

h3 {
    font-family: 'M PLUS Rounded 1c', sans-serif;
}

Css белые коробки:

#FirstWhite{
    width: 750px;
    height: 320px;
    background-color: white;
    margin: 0 auto;
    position: relative;
    bottom: 460px;
    z-index: -1;
    margin-bottom: 5px;
}

#AboutWhite {
    width: 200px;
    height: 650px;
    background-color: white;
    position: relative;
    bottom: 1113px;
    right: 385px;
    z-index: -1;
}

Мобильный css:

@media screen and (max-width:768px)
{
    #img-main {
        width: 100vw;
        height: 200px;
    }

    #img-below {
        width: 30vw;
        height: 30vh;
        margin-bottom: 10px;
    }

    h1, h2 {
        font-size: 7vw;
        position: relative;
        bottom: 100px;
        margin: 0 auto;
        font-family: 'M PLUS Rounded 1c', sans-serif;
    }

    #flex-mobile1 {
        display: flex;
        flex-direction: row;
        position: relative;
        top: 70px;
        right: 120px;
        margin-top: 10px;
    }
    #flex-mobile2 {
        display: flex;
        flex-direction: row;
        position: relative;
        top: 150px;
        left: 133px;
        margin-top: 10px;
    }


    #FirstWhite{
        width: 100vw;
        height: 500px;
        background-color: white;
        display: block;
        margin: 0 auto;
        position: relative;
        bottom: 460px;
        z-index: -1;
        margin-bottom: 5px;
    }

    #AboutWhite {
        width: 100vw;
        height: 500px;
        background-color: white;
        position: relative;
        left: 1000px; 
    }
}
...