Home>

Always set, but position: relative;
After that, the arrangement is arranged with position: absolute with respect to the parent element of header-container.
Is there a way to set without using position?

Applicable source code
<header>
        
        
          
            
              
                
              
            
          
          <nav>
            <ul>
              <li>Top</li>
              <li>Menu</li>
              <li>About</li>
              <li>Conpany</li>
              <li>Contact</li>
            </ul>
          </nav>
          
            
              <span></span>
              <span></span>
              <span></span>
            
          <!-/ nav-toggle->
          <!-/ js-black-bg->
        <!-/ header-container->
      
      </header><!-/ header->
/* header * /
header #header_bg {
  background-image: url ("../ img/header_bg.png");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  padding-top: 61%;
  position: relative;
}
header #header_bg .header_container {
  max-width: 1340px;
  width: 95%;
  margin-left: auto;
  margin-right: auto;
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
     -moz-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
  -webkit-box-align: center;
  -webkit-align-items: center;
     -moz-box-align: center;
      -ms-flex-align: center;
          align-items: center;
  padding: 30px 0;
  position: absolute;
  top: 8%;
  left: 50%;
  -webkit-transform: translateY (-50%) translateX (-50%);
     -moz-transform: translateY (-50%) translateX (-50%);
          transform: translateY (-50%) translateX (-50%);
}
header #header_bg .header_container .header_logo h1.logo {
  width: 220px;
}
header #header_bg .header_container .header_logo h1.logo a img {
  width: 45%;
}
header #header_bg .header_container nav.globalnav ul.menu {
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
}
@media screen and (min-width: 768px) {
  header #header_bg .header_container .nav_toggle {
    display: none;
  }
}
@media screen and (max-width: 768px) {
  header #header_bg .header_container {
    display: block;
  }
}
  • Answer # 1

    This is the method I use often.
    There may be a better way. .

                               
    header {
        background-image: url ("header_bg.png");
    }
    header .headerInner {
        display: flex;
        max-width: 1000px;
        margin: 0 auto;
        padding: 20px;
    }
    header .headerInner h1 {
        margin-right: auto;
    }
    header .headerInner h1 img {
        display: block;
    }
    header nav.navGlobal>ul {
        display: flex;
        list-style: none;
    }
    header nav.navGlobal ul>li {
        margin: 20px;
    }
    @media screen and (min-width: 768px) {
        header nav.navGlobal .menuSp {
            display: none;
        }
    }
    @media screen and (max-width: 768px) {
        header nav.navGlobal .menuSp {
            display: block;
        }
        header nav.navGlobal li {
            display: none;
        }
    }