HTML/CSS: How do I keep multiple divs inline horizontally in header? -


so i'm working on webpage, , i'm having problem header. header i'm making has 4 elements:

  • the header background.
  • the website logo (top left)
  • the website title (center)
  • the login button website's application portal

my problem keeps aligning vertically. i'm going link screenshot below temporary page made try , work out issue below. can't seem figure out.

i should add did using float. having 3 "inner" elements (everything except background) floating, lined properly. unfortunately, works terrible when page resized. if it's less height, components slip out of alignment.

here html/css code. appreciated. can't seem figure out.

.header{    display: inline-block;    text-align: center;    font-family: "comic sans ms", cursive, sans-serif;    font-weight: bold;    width: 100%;    height: 80px;    box-shadow: 0px 3px 5px gray;  }    /* title text in header */  .header-title{    text-shadow: 3px 3px 5px gray;    margin-left: 60px;  }    /* logo div */  .logo{    background-color: aqua;    margin-top: 5px;    margin-left: 10px;    border: solid 1px gray;    border-radius: 10px;    box-shadow: 2px 2px 5px gray;  }    /* div in header user status/login/logout/etc */  .user-status{    margin-top: 5px;    margin-right: 60px;  }    /* header style welcome page */  .header-welcome{    background-color: orange;    color: black;  }    .btn-link{    font-size: 15px;    white-space: normal;    width: 100px;    margin-top: 10px;    border: solid 1px gray;    border-radius: 10%;  }    .btn-link:hover{    border: solid 1px blue;    border-radius: 10%;    color: blue;  }
<div class="header header-welcome">    <div class="logo">      <img src="./img/ehslogo.png" height="70px"/>    </div>    <div class="header-title">      <h1>temp title</h1>    </div>      <div class="user-status">      <form method="get">        <input class="btn-link" type="submit"                name="loginbutton"                value="login button"/>      </form>    </div>  </div>

screenshot - here can see components aligned vertically. want 3 fit horizontally inside orange bar @ top. logo should not wide is.

add css rule .header-welcome> div{display: inline-block;}

/* header style welcome page */  .header-welcome{    background-color: orange;    color: black;  }  /*rule add*/  .header-welcome> div{display: inline-block;}  /* logo div */  .logo{    background-color: aqua;    margin-top: 5px;    margin-left: 10px;    border: solid 1px gray;    border-radius: 10px;    box-shadow: 2px 2px 5px gray;  }    /* div in header user status/login/logout/etc */  .user-status{    margin-top: 5px;    margin-right: 60px;  }      .btn-link{    font-size: 15px;    white-space: normal;    width: 100px;    margin-top: 10px;    border: solid 1px gray;    border-radius: 10%;  }    .btn-link:hover{    border: solid 1px blue;    border-radius: 10%;    color: blue;  }
<div class="header header-welcome">    <div class="logo">      <img src="./img/ehslogo.png" height="70px"/>    </div>    <div class="header-title">      <h1>temp title</h1>    </div>      <div class="user-status">      <form method="get">        <input class="btn-link" type="submit"                name="loginbutton"                value="login button"/>      </form>    </div>  </div>


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -