【问题标题】:Problem with making image portfolio - bootstrap,html,css制作图像组合的问题 - bootstrap、html、css
【发布时间】:2021-12-20 18:13:36
【问题描述】:

我在创建一些图片作为作品集时遇到了问题。当我在那里添加图像并查看图像是否显示时->顶部的视频在其下方播放并启用了自动播放。我不知道如何解决这个问题。我试图弄清楚它是什么,但我不能。
请帮帮我

@import url('https://fonts.googleapis.com/css2?family=Montserrat&family=Source+Sans+Pro:ital,wght@0,200;0,300;1,300&display=swap');
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #ffffff;
  font-family: 'Source Sans Pro', sans-serif;
}


/*--------------------
    typographhy
    ----------------------*/

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 300;
}

h1 {
  font-size: 40px;
  font-weight: 200;
  line-height: 50px;
}

h2 {
  font-size: 30px;
  line-height: 40px;
  margin-top: 0;
}

h3 {
  font-size: 20px;
  font-weight: bold;
  line-height: 32px;
}

h4 {
  color: #505050;
  font-size: 18px;
  line-height: 28px;
}

p {
  color: #757575;
  font-size: 16px;
  font-weight: 300;
  line-height: 29px;
  letter-spacing: 0.5px;
}


/*-----------------------
    buttons
    --------------------------*/

.section-btn {
  margin: 32px 0 0 0;
  padding: 0;
}

.section-btn a {
  color: #fff;
  font-weight: normal;
  line-height: 45px;
  perspective: 1000px;
}

.section-btn a span {
  position: relative;
  display: inline-block;
  font-size: 18px;
  font-weight: normal;
  letter-spacing: 0.5px;
  padding: 2px 27px;
  background: #4dc47d;
  border-radius: 1px;
  transition: transform 0.3s;
  transform-origin: 50% 0;
  transform-style: preserve-3d;
}

.section-btn a span::before {
  position: absolute;
  top: 100%;
  left: 0;
  height: 100%;
  width: 100%;
  color: #fff;
  background: #000;
  border-radius: 1px;
  padding: 2px 27px;
  transition: background 0.3s;
  transform: rotateX(-90deg);
  content: attr(data-hover);
  transform-origin: 50% 0;
}

.section-btn a:hover span,
.section-btn a:focus span {
  transform: rotateX(90deg) translateY(-22px);
}


/*----------------------
    GENERAL
    ------------------------*/

#about,
#project,
#team,
#contact,
footer {
  background: #ffffff;
}


/*-----------------------
    MENU
    ----------------------*/

.navbar .navbar-brand {
  font-weight: normal;
  font-size: 25px;
  color: #ffffff !important;
}

.navbar .navbar-nav .nav-link {
  font-weight: normal;
  font-size: 14px;
  letter-spacing: 0.5px;
  padding: 0;
  text-transform: uppercase;
  transition: all ease-in 0.4s;
  color: #ffffff !important;
}


/*----
    -----*/

.navbar .navbar-nav .nav-link:hover {
  background: transparent;
  color: #fff;
}

.navbar .navbar-nav .nav-link::after {
  content: "";
  display: block;
  width: 0;
  height: 2px;
  background: transparent;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.navbar .navbar-nav .nav-link:hover::after {
  width: 100%;
  background: #fff;
  color: #fff;
}


/*--------------------
    HOME
    ----------------------*/

#home {
  display: flex;
  /* aby bolo všetko in row*/
  align-items: center;
  height: 100vh;
  position: relative;
}

#home video {
  position: fixed;
  top: 50%;
  left: 50%;
  min-height: 100%;
  min-width: 100%;
  height: auto;
  width: auto;
  transform: translateX(-50%) translateY(-50%);
  background-size: cover;
  object-fit: cover;
  box-sizing: border-box;
  overflow: hidden;
  /*aby sme fixli navbar - inak by bol "za" videom*/
  z-index: -100;
  transition: 1s opacity;
}

#home .overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
}

#home h1 {
  color: #fff;
  font-size: 7vw;
  /* view width, it will make our heading responsive - ked dame prec a dame rem, tak nebude h1 responzivny*/
  line-height: 1.2em;
}

#home p {
  color: rgba(250, 250, 250, 0.7);
}

#home .home-text {
  z-index: 99;
}


/*--------------------
    ABOUT
    ----------------------*/

#about {
  position: relative;
}

#about h3 {
  font-size: 14px;
  letter-spacing: 12px;
  text-transform: uppercase;
}


/*--------------------
    PROJECT
    ----------------------*/

#project .project-item {
  position: absolute;
  overflow: hidden;
  margin-bottom: 25px;
  padding: 0;
  vertical-align: middle;
  text-align: center;
}

#project .project-item .project-overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: all ease-in-out 0.4s;
}

#project .project-item:hover .project-overlay {
  opacity: 1;
}

#project .project-item .project-overlay .project-info {
  padding: 12em 0;
}

.project-info h1 {
  color: #fff;
  margin: 0;
}

.project-info h3 {
  color: #d9d9d9;
  margin-top: 0;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.project-item img {
  transition: all ease-in-out 0.4s;
}

.project-item:hover img {
  transform: scale(1.1);
}
<!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>Website v. 1.0</title>
  <link rel="stylesheet" href="css/style.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">

  <link href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.css" rel="stylesheet" type='text/css'>
</head>

<body>

  <header>
    <nav class="navbar navbar-expand-lg navbar-light container py-3 fixed-top">
      <a class="navbar-brand" href="#">Logo</a>
      <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                    <i class="fa fa-bars text-light" aria-hidden="true"></i>
                </button>

      <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav ml-auto float-right text-right">
          <li class="nav-item">
            <a class="nav-link ml-5" href="#">home</a>
          </li>
          <li class="nav-item">
            <a class="nav-link ml-5" href="#">studio</a>
          </li>
          <li class="nav-item">
            <a class="nav-link ml-5" href="#">people</a>
          </li>
          <li class="nav-item">
            <a class="nav-link ml-5" href="#">contact</a>
          </li>
        </ul>
      </div>
    </nav>
  </header>

  <section id="home">

    <video controls="" autoplay="" muted="" loop="">
                <source src="images/video.mp4" type="video/mp4">
            </video>

    <div class="container">
      <div class="row pt-5">
        <div class="home-text col-md-8 col-sm-12 mt-5">
          <h1>dadafdsfdsfdsf</h1>
          <p>fsfdsfsdfdsfsdfsdf:)</p>
          <ul class="section-btn">
            <a href="#"><span data-hover= "more">more</span></a>
          </ul>
        </div>
      </div>
    </div>

    <div class="overlay">

    </div>
  </section>

  <section id="about">
    <div class="container py-5">

      <div class="row py-5 my-5">
        <div class="about-text text-center py-5 col-md-10 col-sm-12 mx-auto">
          <h3 class="pb-3">rererererere</h3>
          <h1>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Error reprehenderit possimus quibusdam magni earum ipsam amet ipsum fugiat ullam dolores quidem id necessitatibus, labore sit eligendi repellat velit commodi impedit?</h1>

        </div>
      </div>

    </div>
  </section>

  <section id="project">

    <div class="container">

      <div class="row">
        <div>
          <div class="project-item">
            <a href="images/project-image1.jpg">
              <img src="images/project-image1.jpg" class="img-fluid">
            </a>
          </div>
        </div>

      </div>
    </div>
  </section>







  <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.min.js" integrity="sha384-VHvPCCyXqtD5DqJeNxl2dtTyhF78xXNXdkwX1CZeRusQfRKp+tA7hAShOK/B/fQ2" crossorigin="anonymous"></script>
</body>

</html>

【问题讨论】:

    标签: html css portfolio


    【解决方案1】:

    将自动播放设置为 false 可能是您正在寻找的内容

    <video controls="" autoplay="false" muted="" loop="">
        <source src="images/video.mp4" type="video/mp4">
    </video>
    

    【讨论】:

    • 没有。这不是问题:/
    猜你喜欢
    • 2020-09-10
    • 1970-01-01
    • 2018-03-31
    • 1970-01-01
    • 2022-09-27
    • 2022-01-20
    • 1970-01-01
    • 1970-01-01
    • 2019-11-11
    相关资源
    最近更新 更多