我无法在div中创建不均匀的列

时间:2019-05-08 05:00:13

标签: javascript html sass

所以我要建立一个新网站,并试图重新获得布局。这次我要制作整页视频的内容部分。我正在尝试制作一个宽度为80%的居中内容部分,并且在该内容范围内,我尝试使用百分比宽度放置两个不均匀的列。但是我似乎做不到。帮助将不胜感激。

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Hello!</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- import the webpage's stylesheet -->
    <link rel="stylesheet" href="/style.css">

    <!-- import the webpage's javascript file -->
    <script src="/script.js" defer></script>
    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
  </head>  
<body>
  <div class="first-container">
    <video autoplay muted loop id="myVideo">
  <source id="myVideo" src="https://cdn.glitch.com/101c0714-db7d-442c-b1de-52537cd6d554%2Fwebsite.mp4?1557188124750" type="video/mp4">
</video>
    <div class="nav-container">
      <div class="nav-row">
          <div class="nav-logo">
            <a href="#">
              U.S AIR FORCE AIRCRAFTS
            </a>
          </div>
          <div class="nav-controls">
              <a href="#">Item One</a>
              <a href="#">Item Two</a>
              <a href="#">Item Three</a>
          </div>
      </div>
    </div>
    <div class="centered">
      <br>
      <p>
        TAEWOO HONG
        <hr>
      </p>
    <h1>
      CURRENT U.S AIRFORCE AIRCRAFTS
    </h1>
    <p style="float: right;">
      <hr>WEBSITE II
    </p>
    </div>
  <div class="content">
    <div class="column" style="background-color: black;">
      Lockheed Martin F-35 Lightning II
    </div>
    <div class="column" style="background-color: gray;">
      STUFF
    </div>
  </div>
  </div>

  <div class="container">
    <div class="row">
      <h1>
        INTRODUCTION
      </h1>
      <p>
        The man in black fled across the desert and the gunslinger followed. 
      </p>
    </div>
  </div>

  <div class="container">
    <div class="row">
      <h1>
        Section
      </h1>
      <p>
        The man in black fled across the desert and the gunslinger followed. 
      </p>
    </div>
  </div>

  <div class="container">
    <div class="row">
      <h1>
        Section
      </h1>
      <p>
        The man in black fled across the desert and the gunslinger followed. 
      </p>
    </div>
  </div>
</body>
</html>
html, body {
  height: 100%;
  color: #666666;
  font-family: "Open Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
  margin: 0;
}

a {
  display: inline-block;
  list-style: none; 
  text-decoration: none;
  color: white;
  transition: opacity .125s linear;

  &:hover {
    opacity: 0.5;
    cursor: pointer;
    transition: opacity .125s linear;
  }

  &:visited {
    color: inherit;
    text-decoration: none;
  }
}

.first-container {
  background: url(https://cdn.glitch.com/101c0714-db7d-442c-b1de-52537cd6d554%2Fwebsite.mp4?1557188124750) no-repeat center center; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  width: 100%;
  height: 100%;
  position: relative;
}

.nav-container {
  height: 75px;
  width: 100%;
  position: fixed;
  color: white;
  //text-transform: uppercase;
  letter-spacing: 0.025em;
  transition: background-color 0.5s ease;
  z-index: 100;

  &.solid-nav {
    background-color: black;
    transition: background-color 0.5s ease;
  }

  .nav-row {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding-right: 25px;
    padding-left: 25px;
    padding-top: 25px;

    .nav-logo {
      display: inline-block;
      font-weight: 900;
    }

    .nav-controls {
      float: right;

      a {
        padding-left: 20px;
      }
    }
  }
}

.container {
  padding-top: 150px;
  padding-bottom: 150px;
  padding-left: 25px;
  padding-right: 25px;
}

.row {
  max-width: 1200px;
  margin: 0 auto;
}

#myVideo {
  z-index: -1;
  position: absolute;
  margin-left: 0; 
  margin-right:0;
  width: 100%;
  max-height: 91.75%;
  object-fit: cover;
}

.centered {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-block;
  font-weight: 900;
  color:white;
}

hr { display: block; height: 1px;
    border: 0; border-top: 1px solid white;
    margin: 1em 0; padding: 0; }

.column {
  float: left;
  width: 50%;
}


.content {
  position: absolute;
  bottom: 0;
  color: #f1f1f1;
  width: 80%;
  padding: 20px;
  overflow: hidden;
  margin-left: auto;
  margin-right: auto;
  display: flex;
}



$(document).ready(function() {
        // Transition effect for navbar 
        $(window).scroll(function() {
          // checks if window is scrolled more than 500px, adds/removes solid class
          if($(this).scrollTop() > 50) { 
              $('.nav-container').addClass('solid-nav');
          } else {
              $('.nav-container').removeClass('solid-nav');
          }
        });
});

0 个答案:

没有答案