CSS justify three elements

144 views Asked by At

I want to have a headline on the left side and buttons on the right side.
Between I want a line.

.container {
  background-image: url(http://www.deutsches-museum.de/fileadmin/Content/010_DM/020_Ausstellungen/100_Museumsinsel/030_Turm/030_Kunst/bild32.jpg);
  height: 100px;
  color: #fff;
}
.col-xs-8 {
  border: 1px solid blue;
}
ul {
  display: flex;
  text-align: justify;
  margin: 0;
  padding: 0;
  list-style-type: none;
}
ul li {
  overflow: hidden;
  white-space: nowrap;
}
li:first-child {
  padding-right: 10px;
}
li:last-child {
  padding-left: 10px;
  font-size: 10px;
}
h2 {
  margin: 10px 0 0 0;
  font-size: 20px;
  font-weight: normal;
}
.fa-stack-1x {
  color: #777;
}
.line {
  margin: 0 auto 5px;
  border-bottom: 2px solid red;
  width: 100%;
}
<div class="container">
  <div class="row">
    <div class="col-xs-8">

      <div class="breadcrump">
        <ul class="menu">
          <li>
            <h2>Here is a example Headline</h2>
          </li>
          <li class="line"></li>
          <li>
            <span class="fa-stack fa-lg">
          <i class="fa fa-square fa-stack-2x"></i>
          <i class="fa fa fa-chevron-left fa-stack-1x"></i>
        </span>
            <span class="fa-stack fa-lg">
          <i class="fa fa-square fa-stack-2x"></i>
          <i class="fa fa fa-chevron-right fa-stack-1x"></i>
        </span>
          </li>
        </ul>
      </div>

    </div>
  </div>
</div>

With justify the line overlays the Headline and the buttons and this is not what I want.

http://codepen.io/daluela/pen/aOVmGw

2

There are 2 answers

0
jaunt On BEST ANSWER

If I understand what you want, all you need to do is replace width:100% in .line with flex:1;.

1
IMI On

Remove overflow:hidden from your list items.

http://codepen.io/anon/pen/gpXgRW

ul li {
    overflow: hidden;/*remove this*/
    white-space: nowrap;
}