0

For some reason I can't figure out how to make my searchContainer appear to the right of #logo and get it to fill the remaining space of top-header.

Could anyone help me out? I know I'm so close. Here is a jsfiddle.

HTML

<div id="top-header" class="slide">
    <div id="cornerBox">&nbsp;</div>
    <a id="logo" href="/">&nbsp;</a>
    <div id="searchBar">&nbsp;</div>
</div>

CSS

#cornerBox {
    float:left;
    width:50px;
    height:50px;
    background-color:#3CC274;
}
#top-header {
    position:absolute;
    height: 56px;
    width:100%;
    min-width:595px;
    max-height: 50px;
    background-color:#24BD66;
    color:#fff;
    z-index:3;
    box-shadow: 0 0 4px rgba(0, 0, 0, .14), 0 4px 8px rgba(0, 0, 0, .23);
}
#logo {
    display:block;
    text-decoration:none;
    float:left;
    width:100px;
    margin:10px 0 0 15px;
    border:1px solid black;
    height:30px;
}
#searchBar {
    border-radius:3px;
    height:35px;
    margin-top:7px;
    background-color:#5ECD8C;
}
bryan
  • 8,879
  • 18
  • 83
  • 166

1 Answers1

0

It looks like all you might need to do is add margin-left: 165px; to your #searchBar style. So,

#searchBar {
    border-radius:3px;
    height:35px;
    margin-top:7px;
    margin-left: 165px;
    background-color:#5ECD8C;
}

I used this StackOverflow answer in formulating my own answer here. Also, I came up with the value of 165px by summing the 50px width from your #cornerBox + the 100px width from your #logo + the extra 15px margin around the #logo.

JSFiddle.

Community
  • 1
  • 1
GoldDragonTSU
  • 487
  • 1
  • 9
  • 23