How to align div content in specific position using Css?

Solution 1:

I have wrapped "Choose a book format", "About" <div class="topnav-inner-wrap"> and applied flexbox css on .topnav & .topnav-inner-wrap

Working Demo: https://jsfiddle.net/k2beLnrv/

function myFunction(){
      var x = document.getElementById("myTopnav");
      if (x.className === "topnav") {
        x.className += " responsive";
      } else {
        x.className = "topnav";
      }
}
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
}

.topnav {
  overflow: hidden;
  background-color: #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topnav a {
  float: left;
  display: block;
  color: #f2f2f2;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 17px;
}

.topnav a:hover {
  background-color: #ddd;
  color: black;
}

.topnav a.active {
  background-color: #04aa6d;
  color: white;
}

.topnav .icon {
  display: none;
}

@media screen and (max-width: 600px) {
  .topnav > a:not(:first-child) {
    display: none;
  }
  .topnav a.icon {
    float: right;
    display: block;
  }
}

@media screen and (max-width: 600px) {
  .topnav.responsive {
    position: relative;
    display: block;
  }
  .topnav.responsive .icon {
    position: absolute;
    right: 0;
    top: 0;
  }
  .topnav.responsive a,
  .topnav.responsive .topnav-inner-wrap {
    float: none;
    display: block;
    text-align: left;
  }
}

@media screen and (max-width: 1200px) {
  .topnav > a:not(:first-child), .topnav .topnav-inner-wrap {
    display: none;
  }
  .topnav a.icon {
    float: right;
    display: block;
  }
}

@media screen and (max-width: 1200px) {
  .topnav.responsive {
    position: relative;
    display: block;
  }
  .topnav.responsive .icon {
    position: absolute;
    right: 0;
    top: 0;
  }
  .topnav.responsive a,
  .topnav.responsive .topnav-inner-wrap {
    float: none;
    display: block !important;
    text-align: left;
  }
}

/* select dropdown css code */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  -ms-appearance: none;
  appearance: none;
  outline: 0;
  box-shadow: none;
  border: 0 !important;
  background: #5c6664;
  background-image: none;
  flex: 1;
  padding: 0 0.5em;
  color: #fff;
  cursor: pointer;
  font-size: 1em;
  font-family: "Open Sans", sans-serif;
}
select::-ms-expand {
  display: none;
}
.select {
  position: relative;
  display: flex;
  width: 20em;
  height: 3em;
  line-height: 3;
  background: #5c6664;
  overflow: hidden;
  border-radius: 0.25em;
}
.select::after {
  content: "\25BC";
  position: absolute;
  top: 0;
  right: 0;
  padding: 0 1em;
  background: #2b2e2e;
  cursor: pointer;
  pointer-events: none;
  transition: 0.25s all ease;
}
.select:hover::after {
  color: #23b499;
}

.topnav-inner-wrap {
  display: flex;
  align-items: center;
}
<div class="topnav" id="myTopnav">
      <a href="#home" class="active">Red FMTuning</a>
      <a href="#news" class="aligntune">Choose a tune from ur favourite</a>
      <div class="topnav-inner-wrap">
      <a href="#contact">
      <div class="select">
          <select name="format" id="format">
            <option selected>Choose a book format</option>
            <option value="pdf">PDF</option>
            <option value="txt">txt</option>
            <option value="epub">ePub</option>
            <option value="fb2">fb2</option>
            <option value="mobi">mobi</option>
          </select>
        </div></a
      >
      <a href="#about" class="alignout">About</a>
      </div>
      <a href="javascript:void(0);" class="icon" onclick="myFunction()">
        <i class="fa fa-bars"></i>
      </a>
    </div>