2

Пишу сайт. В связи с тем что часто уезжаю, пишу на пк и на ноутбуке. Код один и тот же, в одной и той же программе, но на пк сайт выглядит нормально, а на ноутбуке почему то одна часть выглядит не так как нужно. Ломается определенная часть:

index.html:

<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>Photography</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="Home_page_style.css">
    <script src="https://kit.fontawesome.com/a076d05399.js">
    </script>

    </script>
  </head>
  <body>
    <nav>
      <input type="checkbox" id="check">
      <label for="check" class="checkbtn">
        <i class="fas fa-bars"></i>
      </label>
      <label class="logo">Stanislav Zakharov</label><br />
      <label class="sub_logo">Photography</label>

      <ul>
        <li><a class="active" href="#">Home</a></li>
        <li><a href="#">Gallery</a></li>
        <li><a href="#">About</a></li>
        <li><a href="#">Contact</a></li>
      </ul>
    </nav>
    <section></section>
    <div class="gallery_part">

      <h1 class="gallery_logo"><i class="far fa-images"></i>Gallery</h1>

      <h3>Latest Photos:</h3>

    <div class="container">

      <div class="row">
        <div class="column">
          <img class="demo cursor" src="img/car_build_bg.jpg" style="width:100%" onclick="currentSlide(1)" alt="The Woods"
          oncontextmenu="return false;">
        </div>
        <div class="column">
          <img class="demo cursor" src="img/car_park_bg.jpg" style="width:100%" onclick="currentSlide(2)" alt="Cinque Terre"
          oncontextmenu="return false;">
        </div>
        <div class="column">
          <img class="demo cursor" src="img/car_road_bg.jpg" style="width:100%" onclick="currentSlide(3)" alt="Mountains and fjords" oncontextmenu="return false;">
        </div>
        <div class="column">
          <img class="demo cursor" src="img/wheel.jpg" style="width:100%" onclick="currentSlide(4)" alt="Northern Lights" oncontextmenu="return false;">
        </div>
        <div class="column">
          <img class="demo cursor" src="img/car_build_bg.jpg" style="width:100%" onclick="currentSlide(5)" alt="Nature and sunrise" oncontextmenu="return false;">
        </div>
        <div class="column">
          <img class="demo cursor" src="img/car_filtered_wide.jpg" style="width:100%" onclick="currentSlide(6)" alt="Snowy Mountains"
          oncontextmenu="return false;">
        </div>
      </div>
    </div>

    <h3 class="goto">To see more photos go to
      <a href="#" class="gallery">Gallery</a>
    </h3>

  </body>
</html>

style.css:

@import url('https://fonts.googleapis.com/css?family=Poppins:400,500,600,700&display=swap');
*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  list-style: none;
  text-decoration: none;
  font-family: "montseratt", sans-serif;
  background-image: linear-gradient(180deg, #8e9eab, ##eef2f3);
}

body {
  background-image: linear-gradient(180deg, #8e9eab, ##eef2f3);
  background-image:
}

nav{
  background: #333;
  height: 100px;
  width: 100%;
}
label.logo{
  color: #e3e3e3;
  font-size: 33px;
  margin-top: 70px;
  padding: 0 140px;
  font-weight: 600;
  font-family: 'montseratt', sans-serif;
}

label.sub_logo {
    color: #e3e3e3;
    font-size: 23px;
    transform: translateY(100%);
    margin-top: 70px;
    padding: 0 140px;
    font-weight: 600;
    font-family: 'montseratt', sans-serif;
}

nav ul{
  float: right;
  margin-right: 60px;
}
nav ul li{
  display: inline-block;
  line-height: 0px;
  margin: 0 2px;
}
nav ul li a{
  color: #fff;
  font-weight: 500;
  font-size: 20px;
  padding: 7px 13px;
  border-radius: 3px;
  text-transform: uppercase;
  font-family: "montseratt", sans-serif;
  transition: .6s;
}
a.active,a:hover{
  background:  #f1c40f;
  color: #333;
  transition: .5s;
}
.checkbtn{
  font-size: 30px;
  color: #fff;
  float: right;
  line-height: 60px;
  margin-right: 40px;
  cursor: pointer;
  display: none;
}
#check{
  display: none;
}
@media (max-width: 952px){
  label.logo{
    margin-top: 40px;
    font-size: 30px;
    padding-left: 25px;
  }
  label.sub_logo {
    margin-top: 50px;
    font-size: 20px;
    padding-left: 25px;
  }
  nav ul li a{
    font-size: 18px;
  }
}
@media (max-width: 858px){
  .checkbtn{
    display: block;
    margin-right: 40px;
  }
  ul{
    position: fixed;
    width: 100%;
    height: 100vh;
    background: #8e44ad;
    top: 80px;
    left: -100%;
    text-align: center;
    transition: all .3s;
  }
  nav ul li{
    display: block;
    margin: 50px 0;
    line-height: 30px;
  }
  nav ul li a{
    font-size: 20px;
  }
  a:hover,a.active{
    background: none;
    color: #f1c40f;
  }
  #check:checked ~ ul{
    left: 0;
  }

  .column {
    transform: translateX(50%);
    width: 20%;
    display: inline-block;
  }
}

.gallery_part {
  margin-top: 60px;
}

.gallery_part h1 .gallery_logo {
    text-align: center;
    color: #333;
    letter-spacing: 0.3em;
    border-top: 2px solid #333;
    border-bottom: 2px solid #333;
    padding-top: 30px;
    padding-bottom: 30px;
    margin-left: 700px;
    margin-right: 700px;
    transition: .6s;
}

.gallery_part h1.gallery_logo:hover {
    text-align: center;
    color: #333;
    letter-spacing: 0.3em;
    border-top: 2px solid #333;
    border-bottom: 2px solid #333;
    padding-top: 30px;
    padding-bottom: 30px;
    margin-left: 470px;
    margin-right: 470px;
    transition: .6s;
}

.gallery_part h3 {
  text-align: center;
  text-transform: uppercase;
  margin: 30px auto 30px auto;
}

.gallery_part h3.goto {
  text-align: center;
  text-transform: uppercase;
  margin: 30px auto 30px auto;
}

.gallery_part h3.goto a.gallery {
  color: #444;
  transition: .0s;
}

.gallery_part h3.goto a.gallery:hover {
  color: gray;
  text-decoration: underline;
  background: none;
  transition: .0s;
}

.mySlides {
  display: none;
}

.cursor {
  cursor: pointer;
}

.prev,
.next {
  cursor: pointer;
  position: absolute;
  top: 40%;
  width: auto;
  padding: 16px;
  margin-top: -50px;
  color: white;
  font-weight: bold;
  font-size: 20px;
  border-radius: 0 3px 3px 0;
  user-select: none;
  -webkit-user-select: none;
}

.next {
  right: 0;
  border-radius: 3px 0 0 3px;
}

.prev:hover,
.next:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.numbertext {
  color: #f2f2f2;
  font-size: 12px;
  padding: 8px 12px;
  position: absolute;
  top: 0;
}

.row:after {
  content: "";
  display: table;
  clear: both;
}

.container {
  position: relative;
}

.row {
  border: 1px solid #fff
}

.column {
  transform: translateX(50%);
  width: 14%;
  display: inline-block;
}

.demo {
  filter: brightness(80%);
  transition: .5s;
}

.active,
.demo:hover {
  filter: brightness(100%);
  transform: scale(120%);
  transition: .5s;
}

Фотографии самой проблемы: Вот как выглядит "Gallery" на ПК:

введите сюда описание изображения

И вот как выглядит когда открыл с ноутбука:

введите сюда описание изображения

С чем это может быть связано?

7
  • Браузер используете один и тот же?
    – Kirzzz
    6 июл 2020 в 11:28
  • да, Google Chrome. Может нужно добавить -webkit-?
    – mega asda
    6 июл 2020 в 11:30
  • Это же не весь код... И зачем использовать тэг курсива чтобы назначить изображение ему (што?), когда есть псевдокласс :before, в крайнем случае div(background) или тэг img... Проблема кроется в разметке, но чтобы конкретно сказать где именно - прикрепите ПОЛНОСТЬЮ весь код целиком, и оформите его в сниппет (в чате кнопочка "вставить сниппет") 6 июл 2020 в 11:38
  • кеш css ? ctrl+f5 6 июл 2020 в 11:39
  • @Rikky добавил весь код. я понимаю за псевдоклассы, просто почему же на пк работает а тут - нет
    – mega asda
    6 июл 2020 в 11:45

1 ответ 1

1

Так? На ноутбуке тоже будет по центру.

@import url('https://fonts.googleapis.com/css?family=Poppins:400,500,600,700&display=swap');
*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  list-style: none;
  text-decoration: none;
  font-family: "montseratt", sans-serif;
  background-image: linear-gradient(180deg, #8e9eab, ##eef2f3);
}

body {
  background-image: linear-gradient(180deg, #8e9eab, ##eef2f3);
  background-image:
}

nav{
  background: #333;
  height: 100px;
  width: 100%;
}
label.logo{
  color: #e3e3e3;
  font-size: 33px;
  margin-top: 70px;
  padding: 0 140px;
  font-weight: 600;
  font-family: 'montseratt', sans-serif;
}

label.sub_logo {
    color: #e3e3e3;
    font-size: 23px;
    transform: translateY(100%);
    margin-top: 70px;
    padding: 0 140px;
    font-weight: 600;
    font-family: 'montseratt', sans-serif;
}

nav ul{
  float: right;
  margin-right: 60px;
}
nav ul li{
  display: inline-block;
  line-height: 0px;
  margin: 0 2px;
}
nav ul li a{
  color: #fff;
  font-weight: 500;
  font-size: 20px;
  padding: 7px 13px;
  border-radius: 3px;
  text-transform: uppercase;
  font-family: "montseratt", sans-serif;
  transition: .6s;
}
a.active,a:hover{
  background:  #f1c40f;
  color: #333;
  transition: .5s;
}
.checkbtn{
  font-size: 30px;
  color: #fff;
  float: right;
  line-height: 60px;
  margin-right: 40px;
  cursor: pointer;
  display: none;
}
#check{
  display: none;
}
@media (max-width: 952px){
  label.logo{
    margin-top: 40px;
    font-size: 30px;
    padding-left: 25px;
  }
  label.sub_logo {
    margin-top: 50px;
    font-size: 20px;
    padding-left: 25px;
  }
  nav ul li a{
    font-size: 18px;
  }
}
@media (max-width: 858px){
  .checkbtn{
    display: block;
    margin-right: 40px;
  }
  ul{
    position: fixed;
    width: 100%;
    height: 100vh;
    background: #8e44ad;
    top: 80px;
    left: -100%;
    text-align: center;
    transition: all .3s;
  }
  nav ul li{
    display: block;
    margin: 50px 0;
    line-height: 30px;
  }
  nav ul li a{
    font-size: 20px;
  }
  a:hover,a.active{
    background: none;
    color: #f1c40f;
  }
  #check:checked ~ ul{
    left: 0;
  }

  .column {
    transform: translateX(50%);
    width: 20%;
    display: inline-block;
  }
}

.gallery_part {
  margin-top: 60px;
}

.gallery_part h1 .gallery_logo {
    text-align: center;
    color: #333;
    letter-spacing: 0.3em;
    border-top: 2px solid #333;
    border-bottom: 2px solid #333;
    padding-top: 30px;
    padding-bottom: 30px;
    margin-left: 700px;
    margin-right: 700px;
    transition: .6s;
}

.gallery_part h1 {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.gallery_part h1.gallery_logo:hover {
    color: #333;
    letter-spacing: 0.3em;
    border-top: 2px solid #333;
    border-bottom: 2px solid #333;
    padding-top: 30px;
    padding-bottom: 30px;
   /* margin-left: 470px;
    margin-right: 470px;*/
    transition: .6s;
}

.gallery_part h3 {
  text-align: center;
  text-transform: uppercase;
  margin: 30px auto 30px auto;
}

.gallery_part h3.goto {
  text-align: center;
  text-transform: uppercase;
  margin: 30px auto 30px auto;
}

.gallery_part h3.goto a.gallery {
  color: #444;
  transition: .0s;
}

.gallery_part h3.goto a.gallery:hover {
  color: gray;
  text-decoration: underline;
  background: none;
  transition: .0s;
}

.mySlides {
  display: none;
}

.cursor {
  cursor: pointer;
}

.prev,
.next {
  cursor: pointer;
  position: absolute;
  top: 40%;
  width: auto;
  padding: 16px;
  margin-top: -50px;
  color: white;
  font-weight: bold;
  font-size: 20px;
  border-radius: 0 3px 3px 0;
  user-select: none;
  -webkit-user-select: none;
}

.next {
  right: 0;
  border-radius: 3px 0 0 3px;
}

.prev:hover,
.next:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.numbertext {
  color: #f2f2f2;
  font-size: 12px;
  padding: 8px 12px;
  position: absolute;
  top: 0;
}

.row:after {
  content: "";
  display: table;
  clear: both;
}

.container {
  position: relative;
}

.row {
  border: 1px solid #fff
}

.column {
  transform: translateX(50%);
  width: 14%;
  display: inline-block;
}

.demo {
  filter: brightness(80%);
  transition: .5s;
}

.active,
.demo:hover {
  filter: brightness(100%);
  transform: scale(120%);
  transition: .5s;
}
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>Photography</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="Home_page_style.css">
    <script src="https://kit.fontawesome.com/a076d05399.js">
    </script>

    </script>
  </head>
  <body>
    <nav>
      <input type="checkbox" id="check">
      <label for="check" class="checkbtn">
        <i class="fas fa-bars"></i>
      </label>
      <label class="logo">Stanislav Zakharov</label><br />
      <label class="sub_logo">Photography</label>

      <ul>
        <li><a class="active" href="#">Home</a></li>
        <li><a href="#">Gallery</a></li>
        <li><a href="#">About</a></li>
        <li><a href="#">Contact</a></li>
      </ul>
    </nav>
    <section></section>
    <div class="gallery_part">

      <h1 class="gallery_logo"><i class="far fa-images"></i>Gallery</h1>

      <h3>Latest Photos:</h3>

    <div class="container">

      <div class="row">
        <div class="column">
          <img class="demo cursor" src="img/car_build_bg.jpg" style="width:100%" onclick="currentSlide(1)" alt="The Woods"
          oncontextmenu="return false;">
        </div>
        <div class="column">
          <img class="demo cursor" src="img/car_park_bg.jpg" style="width:100%" onclick="currentSlide(2)" alt="Cinque Terre"
          oncontextmenu="return false;">
        </div>
        <div class="column">
          <img class="demo cursor" src="img/car_road_bg.jpg" style="width:100%" onclick="currentSlide(3)" alt="Mountains and fjords" oncontextmenu="return false;">
        </div>
        <div class="column">
          <img class="demo cursor" src="img/wheel.jpg" style="width:100%" onclick="currentSlide(4)" alt="Northern Lights" oncontextmenu="return false;">
        </div>
        <div class="column">
          <img class="demo cursor" src="img/car_build_bg.jpg" style="width:100%" onclick="currentSlide(5)" alt="Nature and sunrise" oncontextmenu="return false;">
        </div>
        <div class="column">
          <img class="demo cursor" src="img/car_filtered_wide.jpg" style="width:100%" onclick="currentSlide(6)" alt="Snowy Mountains"
          oncontextmenu="return false;">
        </div>
      </div>
    </div>

    <h3 class="goto">To see more photos go to
      <a href="#" class="gallery">Gallery</a>
    </h3>

  </body>
</html>

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.