I have two divs encased in a larger div. I thought this would make the two divs display within the parent, but for some reason they display outsie of it. I have tried every different combination of position types I can think of, and I tried display: inline. Does anyone know how I can position the two divs inside of their parent?
Here's my css file:
#Buttons {
float: center;
height: 100px;
width: 900px;
#Button1 {
width: 20px;
}
#Button2 {
width: 20px;
}
}
application.html.erb
<div id="Buttons">
<div id="Button1">
<%= link_to "button1", "#", :class "btn btn-large" %>
</div>
<div id="Button2">
<%= link_to "Button2", "#", :class "btn btn-large" %>
</div>
</div>
UPDATE: Adding inline: display to #Button1 and #Button2 makes them display within #buttons:
#Buttons {
float: center;
height: 100px;
width: 900px;
#Button1 {
width: 20px;
display: inline;
}
#Button2 {
width: 20px;
display: inline;
}
}
but I added the exact same code to #SearchBar, and it's still displaying outside of it's navbar:
#SearchBar {
height: 30px;
width: 30px;
display: inline;
#p {margin: 0px;}
}
.navbar {
height: 130px;
}
Here's the html for my entire heading:
<header class=navbar navbar-fixed-top navbar-inverse">
<div id="Buttons">
<div id="Button1">
<a class="btn btn-large btn-primary" href="/subjects/1">1</a>
</div>
<div id="Button2">
<a class="btn btn-large btn-primary" href="/subjects/2">2</a>
</div>
</div>
<div id= "SearchBar">
<form accept-charset="UTF-8" action="/things" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓" /></div>
<p id="p">
<input id="search" name="search" type="text" />
<button class="btn" type="submit"><i class="thing-search">Go</i></button>
</p>
</form> </div>
</header>