How to display items aligned? - html

this is for sure a common question but text-align and display properties are not solving it, so i must have some mistake.
What should i do to display the 3 items in the same horizontal line?
.contact__information {
vertical-align: middle;
margin-bottom: var(--mb-1);
padding-right: var(--mb-.75);
align-items: right;
text-align: center;
display: inline-flex;
margin-left: auto;
margin-right: auto;
}
<section class="contact section" id="contact">
<h2 class="section__title">Contacte</h2>
<span class="section__subtitle">Contacte para mais informações</span>
<div class="contact__information">
<i class="uil uil-phone contact__icon"></i>
<div>
<h3 class="contact__title">Telemóvel</h3>
<span class="contact__subtitle">999-777-666</span>
</div>
</div>
<div class="contact__information">
<i class="uil uil-envelope contact__icon"></i>
<div>
<h3 class="contact__title">Email</h3>
<span class="contact__subtitle">email.com</span>
</div>
</div>
<div class="contact__information">
<i class="uil uil-map-marker contact__icon"></i>
<div>
<h3 class="contact__title">Morada</h3>
<span class="contact__subtitle">Portugal</span>
</div>
</div>
</section>

Step 1: Define width
Step 2: Locate parent to flex - #contact
Step 3: align-items: center; makes all elements inline (aligned)
Step 4: justify-content: space-evenly; spaces all elements evenly. Using up extra space.
#contact {
width: 100%;
display: flex;
align-items: center;
justify-content: space-evenly;
}
<section class="contact section" id="contact">
<h2 class="section__title">Contacte</h2>
<span class="section__subtitle">Contacte para mais informações</span>
<div class="contact__information">
<i class="uil uil-phone contact__icon"></i>
<div>
<h3 class="contact__title">Telemóvel</h3>
<span class="contact__subtitle">999-777-666</span>
</div>
</div>
<div class="contact__information">
<i class="uil uil-envelope contact__icon"></i>
<div>
<h3 class="contact__title">Email</h3>
<span class="contact__subtitle">email.com</span>
</div>
</div>
<div class="contact__information">
<i class="uil uil-map-marker contact__icon"></i>
<div>
<h3 class="contact__title">Morada</h3>
<span class="contact__subtitle">Portugal</span>
</div>
</div>
</section>

Feels like an opportunity for flex. I added borders and padding just to make it obvious what was where and did some alignment you can customize as needed
.contact.section {
display: flex;
flex-direction: row;/* or column if you want the first two on top */
justify-content: flex-start;
align-items: center;
}
.contact__information,
.contact__information div { /*probably need a class for the div */
display: flex;
flex-direction: row;
justify-content: center;
border: solid 1px lime;
padding:0.25rem;
}
.contact__information div {
display: flex;
flex-direction: column;/* or row if titles are in line with data */
border: solid 1px pink;
}
.contact__title {
border: solid blue 1px;
padding: 0.5rem;
align-self: center;
}
.contact__subtitle {
border: solid #8d8dff 1px;
padding: 0.5rem;
align-self: center;
}
<section class="contact section" id="contact">
<h2 class="section__title">Contacte</h2>
<span class="section__subtitle">Contacte para mais informações</span>
<div class="contact__information">
<i class="uil uil-phone contact__icon"></i>
<div>
<h3 class="contact__title">Telemóvel</h3>
<span class="contact__subtitle">999-777-666</span>
</div>
</div>
<div class="contact__information">
<i class="uil uil-envelope contact__icon"></i>
<div>
<h3 class="contact__title">Email</h3>
<span class="contact__subtitle">email.com</span>
</div>
</div>
<div class="contact__information">
<i class="uil uil-map-marker contact__icon"></i>
<div>
<h3 class="contact__title">Morada</h3>
<span class="contact__subtitle">Portugal</span>
</div>
</div>
</section>

Related

How do I vertically center text and icons in Bulma?

I'm trying to center an icon and text using Bulma and flexbox in a vue.js project, I tried to follow the answer from this question (How to vertically center elements in Bulma?). My icon vertically centers but the text elements seem to be off-center with a few pixels of white space under them. They are both on the same baseline but means they aren't in line with my icon (see image below).
I'm not sure where I am going wrong, I've included my code below, I'd appreciate any help possible please
<template>
<div class="singleProjectContainer" :key="project.id">
<ul class="columns is-flex projectPreview" style="border-bottom: 0.5px solid #c1c1c1;">
<div class="column is-1 is-flex projectIcon">
<li>
<div v-if="project.projectType === 'Identity'"class="projectIcon" >
<img src="../static/SVG/Identity-Circle.svg" alt="circle icon for branding & identity" />
</div>
</li>
</div>
<div class="projectTitle column is-4">
<li> <h3>{{ project.Name }}</h3> </li>
</div>
<div class="projectSummary column is-7">
<li> <p>{{ project.Summary }}</p> </li>
</div>
</ul>
</div>
</template>
<script>
export default {
name: 'ProjectItem',
props: ['project'],
}
</script>
<style scoped>
.columns {
height: 100%;
padding: 0;
margin: 0;
}
.singleProjectContainer {
height: 72x;
margin: 0px;
}
.columns.projectPreview {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.projectIcon {
padding: 0 0 0 10px;
height: 100%;
}
.projectTitle {
height: 100%;
}
.projectIcon img {
height: 20px;
width: 20px;
}
.projectTitle h3 {
font-size: 1.2em;
font-family: 'Sporting Grotesque_Regular';
color: black;
}
</style>
.is-vcentered selector related only to columns:
https://bulma.io/documentation/columns/options/#vertical-alignment
.columns.is-vcentered {
align-items: center;
}
Bulma >= 0.9.1
Since Bulma, 0.9.1 we can use flexbox helpers:
Combined with is-flex, all of the Flexbox CSS properties are available as Bulma helpers:
flex-direction
flex-wrap
justify-content
align-content
align-items
align-self
flex-grow
flex-shrink
Example:
<div class="is-align-items-center is-flex"></div>
Snippet:
<div class="container">
<ul class="list">
<li class="box list-item is-flex is-align-items-center ">
<span class="icon has-text-danger">
<i class="fas has-text-success fa-2x fa-adjust"></i>
</span>
<h2 style="margin-left: 10px; font-size: 60px; line-height: 1;">Hello world</h2>
<h3 style="margin-left: auto;">Right text</h3>
</li>
<li class="box list-item is-flex is-align-content-center">
<span class="icon has-text-danger">
<i class="fas has-text-danger fa-2x fa-exclamation-triangle"></i>
</span>
<h2 style="margin-left: 20px; font-size: 20px;">Item 2</h2>
<h3 style="margin-left: auto;">Right text</h3>
</li>
</ul>
</div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma#0.9.1/css/bulma.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css">
Bulma < 0.9.1 (Old answer)
For lists - No "built-in" way (by helpers) to align icons and text (yet).
One solution - use core is-flex and one CSS custom style (For align-items: center;) .
Snippet:
/* one custom class (not from bulma core) */
li.vcenter{
align-items: center;
}
<div class="container">
<ul class="list">
<li class="list-item is-flex vcenter">
<span class="icon has-text-danger">
<i class="fas has-text-success fa-2x fa-adjust"></i>
</span>
<h2 style="margin-left: 10px; font-size: 60px; line-height: 1;">Hello world</h2>
<h3 style="margin-left: auto;">Right text</h3>
</li>
<li class="list-item is-flex vcenter">
<span class="icon has-text-danger">
<i class="fas has-text-danger fa-2x fa-exclamation-triangle"></i>
</span>
<h2 style="margin-left: 20px; font-size: 20px;">Item 2</h2>
<h3 style="margin-left: auto;">Right text</h3>
</li>
</ul>
</div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma#0.8.2/css/bulma.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css">
Related: How to center text vertically with a large font-awesome icon?

How to move third element in block down with flexbox?

How move third element down, that first block with logo, and second other full width contain another panel,and down will be another panel?
this block (pastenow.ru/57IX6) need to move and it must be like this : pastenow.ru/57IXE
<nav class="navbar">
<!--start of top_panel-->
<div class="logo"><img src="img/logo.png" alt=""> </div>
<div class="panel">
<div class="nav_title">С нами ловят все!</div>
<div class="phone">8 800 553535</div>
<div class="address_wrapper">
<div class="address">Павлодар, ул. Мира 7</div>
<div class="address">Павлодар, ул. Мира 8</div>
</div>
<div class="call_btn def_btn">Заказать звонок</div>
</div>
<!--end of top_panel-->
<!--start of bottom_panel-->
<div class="bottom_panel">
<div class="main">Главная</div>
<div class="about_us">компании</div>
<div class="tournament">Турниры</div>
<div class="goods">Товары</div>
<div class="news">Новости</div>
<div class="photo">Фото</div>
<div class="video">Видео</div>
<div class="contact">Контакты</div>
<div class="social_icons_wrapper">
<div ><i class="fa fa-youtube icon_size" aria-hidden="true"></i></div>
<div ><i class="fa fa-instagram icon_size" aria-hidden="true"></i></div>
<div ><i class="fa fa-vk icon_size" aria-hidden="true"></i></div>
<div ><i class="fa fa-whatsapp icon_size" aria-hidden="true"></i></div>
<div><i class="fa fa-telegram icon_size" aria-hidden="true"></i></div>
</div>
</div>
<!--end of bottom_panel-->
if add flex-wrap: wrap; so all goes down, but i need only one.
css
.container{
width: 1170px;
height: auto;
min-height: 100vh;
display: flex;
flex-wrap: wrap;
justify-content: center;
margin: auto;
font-family: "Museo Cyrl 900";
}
.header_line{
width: 100%;
height: 122px;
background-color: #fff;
}
.navbar{
width: 100%;
display: inline-flex;
justify-content: space-between;
}
.logo{
width: 200px;
height: auto;
}
.panel{
width: 100%;
display: inline-flex;
justify-content: space-between;
}
.bootom_panel{
width: 100%;
display:inline-flex;
justify-content: flex-end;
}
I have made a codepen demo with slight adjustments in the layout which you have provided. Please click on this link: https://codepen.io/ArunK_UI/pen/qwbXLm?editors=1100
Major change here is I have wrapped upper panel and lower panel in one wrapper and then gave them respective properties.
<div class="panel-wrap">
<div class="panel"></div>
<div class="bottom_panel"></div>
</div>

Prevent sibling from being pushed using flex

I have an image, and I display a text to the right and bottom of it , as can be seen in the first snippet(view snippet in full window). Now I want to add another text, and that it will be to the top right of the image, above the other text, but it pushes the bottom text to the right. I want both texts to be relative to the image, but the last paragraph seems to be relative to the sibling.
(**Sorry about the many html tags, I'm using a css framework also)
.justify-content-end {
align-self: flex-end;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.css" rel="stylesheet"/>
<div class="level">
<div class="level-left">
<div class="level-item">
<figure class="image is-128x128">
<img src="https://bulma.io/images/placeholders/128x128.png">
</figure>
</div>
<div class="level-item justify-content-end">
<p>Hello World</p>
</div>
</div>
</div>
And this is the snippet depicting the problem:
.justify-content-start {
align-self: flex-start;
}
.justify-content-end {
align-self: flex-end;
}
#click {
text-align: center;
width: 128px;
cursor: pointer;
border: 1px solid red;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.css" rel="stylesheet" />
<div class="level">
<div class="level-left">
<div class="level-item">
<figure class="image is-128x128">
<img src="https://bulma.io/images/placeholders/128x128.png">
</figure>
</div>
<div class="level-item justify-content-start">
<label class="label">
<p id="click">Click Me!</p>
</label>
</div>
<div class="level-item justify-content-end">
<p>Hello World</p>
</div>
</div>
</div>
Here is my solution
Had to change your structure
<div class=" par">
<label class="label">
<p id="click">Click Me!</p>
</label>
<p>Name Placeholder</p>
</div>
Then
added this to css
.main .stretch{
align-items: stretch;
}
.par{
display:flex;
flex-direction:column;
justify-content:space-between;
}
.justify-content-start {
align-self: flex-start;
}
.justify-content-end {
align-self: flex-end;
}
.main .stretch {
align-items: stretch;
text-align: center;
}
#click {
text-align: center;
width: 128px;
cursor: pointer;
border: 1px solid red;
margin: auto;
}
.par {
display: flex;
flex-direction: column;
justify-content: space-between;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.css" rel="stylesheet" />
<div class="level main">
<div class="level-left stretch">
<div class="level-item">
<figure class="image is-128x128">
<img src="https://bulma.io/images/placeholders/128x128.png">
</figure>
</div>
<div class=" par">
<label class="label">
<p id="click">Click Me!</p>
</label>
<p>Name Placeholder</p>
</div>
</div>
</div>
I usually dislike position:absolute; but it looks like it could be a fair use here .
.justify-content-start {
align-self: flex-start;
min-height: 1.4em; /* keep room for the absolute child */
}
.justify-content-end {
align-self: flex-end;
}
#click {
text-align: center;
width: 128px;
cursor: pointer;
border: 1px solid red;
}
#media (min-width: 768px) {
#click {
position: absolute;
}
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.css" rel="stylesheet" />
<div class="level">
<div class="level-left">
<div class="level-item">
<figure class="image is-128x128">
<img src="https://bulma.io/images/placeholders/128x128.png">
</figure>
</div>
<div class="level-item justify-content-start">
<label class="label">
<p id="click">Click Me!</p>
</label>
</div>
<div class="level-item justify-content-end">
<p>Hello World</p>
</div>
</div>
</div>

How to get the horizontal-card-footer div right below other div and not at right

I want to have a structure like this:
But its not working, the image, date, title and subtitle are ok, but then do you know how to put the Image title right below the image and the view and save links below the other texts with the same margin-left of 1rem?
I have here the Example: http://jsfiddle.net/tyyj57gs/6/, the issue should be because the horizontal-card div have display flex but Im not having sucess solving that issue.
Html:
<div class="container pb-4">
<div class="row">
<div class="col-lg-3">
<div class="horizontal-card">
<img src="http://via.placeholder.com/200x100"/>
<div class="horizontal-card-body">
<span class="card-text">Date</span>
<h4 class="card-title">Title</h4>
<span class="card-text">Subtitle</span>
</div>
<div class="horizontal-card-footer">
<span>Image Title</span>
<a class="card-text status">#View</a>
<a class="card-text status">#Save</a>
</div>
</div>
</div>
CSS
.horizontal-card{
display: flex;
border:1px solid gray;
margin-bottom:1rem;
img{
width: 200px;
height: 100px;
border-bottom: 2px solid red;
}
.horizontal-card-body{
display: flex;
flex-direction: column;
margin-left:1rem;
}
}
I did this by using display:inline-block instead of the flex box you had. The sections are broken into two rows. Add style as you wish.
HTML:
<div class="card">
<div class="row">
<div class="innerLeft">
<img src="http://via.placeholder.com/200x100"/>
</div>
<div class="innerRight">
<div class="horizontal-card-footer">
<span class="card-text">Date</span>
<h4 class="card-title">Title</h4>
<span class="card-text">Subtitle</span>
</div>
</div>
</div>
<div class="row">
<div class="innerLeft">
<p>Image Title</p>
</div>
<div class="innerRight">
<a class="card-text status">#View</a>
<a class="card-text status">#Save</a>
</div>
</div>
</div>
CSS:
.card {
display:block;
width:100%;
max-width:800px;
}
img {
width: 100%;
height: auto;
border-bottom: 2px solid orange;
}
.innerLeft {
display:inline-block;
margin-right:-4px;
vertical-align:top;
width:30%;
text-align:center;
padding:5px;
}
.innerRight {
display:inline-block;
vertical-align:top;
width:70%;
text-align:left;
padding:5px;
}
.card-text {
display:inline-block;
}
FIDDLE : http://jsfiddle.net/tyyj57gs/9/
You can create the layout you want using flexbox.
In the snippet below I have restructured your .horizontal-card into .card-left and .card-right.
.horizontal-card {
display: flex;
border: 1px solid gray;
margin-bottom: 1rem;
}
.card-left,
.card-right {
display: flex;
flex-direction: column;
}
.card-right {
width: 100%;
}
.card-left span {
background: orange;
flex: 1;
display: flex;
justify-content: center;
align-items: center;
}
.horizontal-card-body,
.horizontal-card-footer {
padding-left: 1em;
}
img {
width: 200px;
height: 100px;
}
.horizontal-card-footer {
/* Add to ensure the footer is pinned to the bottom of the card */
margin-top: auto;
border-top: 1px solid grey;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet">
<div class="container pb-4">
<div class="row">
<div class="col-lg-3">
<div class="horizontal-card">
<div class="card-left">
<img src="http://via.placeholder.com/200x100" />
<span>Image Title</span>
</div>
<div class="card-right">
<div class="horizontal-card-body">
<span class="card-text">Date</span>
<h4 class="card-title">Title</h4>
<span class="card-text">Subtitle</span>
</div>
<div class="horizontal-card-footer">
<a class="card-text status">#View</a>
<a class="card-text status">#Save</a>
</div>
</div>
</div>
</div>
<div class="container pb-4">
<div class="row">
<div class="col-lg-3">
<div class="horizontal-card">
<div class="card-left">
<img src="http://via.placeholder.com/200x100" />
<span>Image Title</span>
</div>
<div class="card-right">
<div class="horizontal-card-body">
<span class="card-text">Date</span>
<h4 class="card-title">Title</h4>
<span class="card-text">I am a card with a longer subtitle. I am a card with a longer subtitle. I am a card with a longer subtitle. I am a card with a longer subtitle. </span>
</div>
<div class="horizontal-card-footer">
<a class="card-text status">#View</a>
<a class="card-text status">#Save</a>
</div>
</div>
</div>
</div>
<div class="container pb-4">
<div class="row">
<div class="col-lg-3">
<div class="horizontal-card">
<div class="card-left">
<img src="http://via.placeholder.com/200x100" />
<span>Image Title</span>
</div>
<div class="card-right">
<div class="horizontal-card-body">
<span class="card-text">Date</span>
<h4 class="card-title">Title</h4>
<span class="card-text"></span>
</div>
<div class="horizontal-card-footer">
<a class="card-text status">#View</a>
<a class="card-text status">#Save</a>
</div>
</div>
</div>
</div>
Here is my version of the image. Let me know if there are any issues, I have used position absolute for the footer's position.
For the SCSS version of the CSS refer the fiddle, else refer the snippet below!
JSFiddle Demo
.horizontal-card {
position: relative;
display: flex;
border: 1px solid gray;
margin-bottom: 1rem;
}
.horizontal-card img {
width: 200px;
height: 130px;
border-bottom: 30px solid orange;
}
.horizontal-card .horizontal-card-body {
display: flex;
flex-direction: column;
margin-left: 1rem;
}
.horizontal-card .horizontal-card-footer {
position: absolute;
left: 0px;
right: 0px;
bottom: 0px;
height: 30px;
display: flex;
align-items: center;
}
.horizontal-card .horizontal-card-footer span {
width: 200px;
display: inline-block;
}
.horizontal-card .horizontal-card-footer a {
margin-left: 10px;
}
<div class="container pb-4">
<div class="row">
<div class="col-lg-3">
<div class="horizontal-card">
<img src="http://via.placeholder.com/200x100" />
<div class="horizontal-card-body">
<span class="card-text">Date</span>
<h4 class="card-title">Title</h4>
<span class="card-text">Subtitle</span>
</div>
<div class="horizontal-card-footer">
<span>Image Title</span>
<a class="card-text status">#View</a>
<a class="card-text status">#Save</a>
</div>
</div>
</div>

how do I make multiple divs width change dynamically with out overlapping when window size changes

I have a div with three divs inside of different width. when my window size changes it is overlapping each other.How do I make content remain without overlapping when window size changes.
Here is my code.
#topBarContainer{
background-color: blue;
}
#topBarLeft{
width: 14%;
text-align: center;
}
#topBarMiddle{
width: 26%;
text-align: center;
}
#topBarRight{
width: 60%;
text-align: right;
}
.topBar {
margin-right: -4px;
text-align: center;
display: inline-block;
padding-top: 5px;
padding-bottom: 3px;
}
<div id="topBarContainer">
<!--TopBar-->
<div id="topBarLeft" class="topBar">
<input type="button" ng-click="newMenuType('message')" value="New" id="newButton">
</div>
<!--Top Bar Middle-->
<div id="topBarMiddle" class="topBar">
<div class="searchBoxContainer">
<i class="fa fa-search fa-flip-horizontal" id="searchBoxIcon"> </i>
<input type="text" placeholder="Search Inbox" class="searchBox" ng-model="searchEmail" />
</div>
</div>
<!--Top Bar Right-->
<div id="topBarRight" class="topBar">
<div>
<div class="loginRow">Hi{{loginName()}}</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply"></i>
</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply-all"></i>
</div>
<div ng-if="emailIcon()" class="iconRow" >
<i class="fa fa-reply fa-flip-horizontal"></i>
</div>
<div ng-if="!isDeletedView() && emailIcon()" class="iconRow">
<i class="fa fa-trash"></i>
</div>
</div>
</div>
</div>
It is looking good with normal window when I resize window it is overlapping all.leftBar takes 14%and middle bar takes 26% and rest for the right container.
I am spenting days to fix this. I need to align all so that all 3 sections display in the same line.
you can use display:flex from flexbox
body {
margin: 0
}
#topBarContainer {
background-color: blue;
display: flex;
}
#topBarLeft {
width: 14%;
text-align: center;
}
#topBarMiddle {
text-align: center;
background: red;
width: 35%
}
#topBarRight {
text-align: right;
background: green;
flex: 1
}
#topBarRight > div {
display: inline-flex
}
.topBar {
text-align: center;
padding-top: 5px;
padding-bottom: 3px;
}
#topBarRight >div:last-of-type {
text-align: center
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" />
<div id="topBarContainer">
<!--TopBar-->
<div id="topBarLeft" class="topBar">
<input type="button" ng-click="newMenuType('message')" value="New" id="newButton">
</div>
<!--Top Bar Middle-->
<div id="topBarMiddle" class="topBar">
<div class="searchBoxContainer">
<i class="fa fa-search fa-flip-horizontal" id="searchBoxIcon"> </i>
<input type="text" placeholder="Search Inbox" class="searchBox" ng-model="searchEmail" />
</div>
</div>
<!--Top Bar Right-->
<div id="topBarRight" class="topBar">
<div>
<div class="loginRow">Hi{{loginName()}}</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply"></i>
</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply-all"></i>
</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply fa-flip-horizontal"></i>
</div>
<div ng-if="!isDeletedView() && emailIcon()" class="iconRow">
<i class="fa fa-trash"></i>
</div>
<div ng-show="canMoveToFolder()" class="iconRow" ng-mouseover="newIcon = true" ng-mouseleave="newIcon = false"> <i class="fa fa-folder-o"> </i>
<div ng-if="newIcon" id="newItemOptions">
<label class='newItemLabel' ng-click="moveMessageToFolder(3)">Inbox</label>
<label class='newItemLabel' ng-click="moveMessageToFolder(4)">Sent</label>
</div>
</div>
</div>
</div>
</div>
I'm not sure if it is what you are looking for but if you put your searchBoxContainer in display:flex; it shud solwe the problem cause it puts your searchBoxIcon in front of the searchBox it self
you have to pu in your css
.searchBoxContainer{
display:flex;
}
#topBarContainer{
background-color: blue;
}
#topBarLeft{
width: 14%;
text-align: center;
}
#topBarMiddle{
width: 26%;
text-align: center;
}
#topBarRight{
width: 60%;
text-align: right;
}
.topBar {
margin-right: -4px;
text-align: center;
display: inline-block;
padding-top: 5px;
padding-bottom: 3px;
}
.searchBoxContainer{
display:flex;
}
<div id="topBarContainer">
<!--TopBar-->
<div id="topBarLeft" class="topBar">
<input type="button" ng-click="newMenuType('message')" value="New" id="newButton">
</div>
<!--Top Bar Middle-->
<div id="topBarMiddle" class="topBar">
<div class="searchBoxContainer">
<i class="fa fa-search fa-flip-horizontal" id="searchBoxIcon"> </i>
<input type="text" placeholder="Search Inbox" class="searchBox" ng-model="searchEmail" />
</div>
</div>
<!--Top Bar Right-->
<div id="topBarRight" class="topBar">
<div>
<div class="loginRow">Hi{{loginName()}}</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply"></i>
</div>
<div ng-if="emailIcon()" class="iconRow">
<i class="fa fa-reply-all"></i>
</div>
<div ng-if="emailIcon()" class="iconRow" >
<i class="fa fa-reply fa-flip-horizontal"></i>
</div>
<div ng-if="!isDeletedView() && emailIcon()" class="iconRow">
<i class="fa fa-trash"></i>
</div>
</div>
</div>
</div>
Why are all elements moved right with that negative margin on the .topBar class? I would just erase that, and add box-sizing: border-box; to .topBar (just to be on the safe side for percentage widths and heights).
So you'd have
.topBar {
box-sizing: border-box;
text-align: center;
display: inline-block;
padding-top: 5px;
padding-bottom: 3px;
}