Reputation: 7056
I am trying to use the 960 grid CSS templates, and I am having trouble alligning the banner and a form inline properly.
In my html, I have:
<div class="container_24">
<div class="grid_24">
<div id="banner">
<div id="searchContainer">
<form style="display:inline" >
<input id="field" name="q" type="text"/>
<div id="delete"><span id="x">X</span></div>
<input id="submit" name="submit" type="submit" value="Search" />
</form>
</div>
</div>
</div>
<div class="clear"></div>
</div>
What happens is that the form is overlayed over the banner, which is not what I want. I would like the banner (logo) to be on the left hand corner, and the search form on the right hand corner. Any clues as to what I am doing wrong?
My CSS looks like:
#banner {
/* width: 950px; */
background: #002147;
-moz-border-radius-bottomright: 10px;
border-bottom-right-radius: 10px;
-moz-border-radius-bottomleft: 10px;
border-bottom-left-radius: 10px;
-moz-border-radius-topleft: 10px;
border-top-left-radius: 10px;
-moz-border-radius-topright: 10px;
border-top-right-radius: 10px;
background-image: url(logo.png);
background-repeat: no-repeat;
background-position: 2% 50%;
padding:left: 10px;
padding: 30px;
margin-top:1px;
}
#searchContainer {
margin-left:10px;
margin-top:10px;
}
#searchContainer_np {
margin-left:90px;
margin-top:10px;
}
#field {
float:left;
width:110px;
height:27px;
line-height:27px;
text-indent:10px;
font-family:Ubuntu, sans-serif;
font-size:1em;
color:#333;
background: #fff;
border:solid 1px #002147;
border-top:solid 1px #002147;
border-right:none;
display: inline-block;
}
#delete {
float:left;
width:16px;
height:29px;
line-height:27px;
margin-right:15px;
padding:0 10px 0 10px;
font-family: Ubuntu,sans-serif;
font-size:22px;
background: #fff;
border:solid 1px #002147;
border-top:solid 1px #002147;
border-right:solid 1px #002147;
border-left:none;
}
#delete #x {
color:#A1B9ED;
cursor:pointer;
display:none;
}
#submit {
color: #6e6e6e;
font: bold 12px Ubuntu, sans-serif;
text-decoration: none;
padding: 6px 12px;
position: relative;
display: inline-block;
text-shadow: 0 1px 0 #fff;
-webkit-transition: border-color .218s;
-moz-transition: border .218s;
-o-transition: border-color .218s;
transition: border-color .218s;
background: #f3f3f3;
background: -webkit-gradient(linear,0% 40%,0% 70%,from(#F5F5F5),to(#F1F1F1));
background: -moz-linear-gradient(linear,0% 40%,0% 70%,from(#F5F5F5),to(#F1F1F1));
border: solid 1px #dcdcdc;
border-radius: 2px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
margin-right: 50%;
border:solid 1px #002147;
border-top:solid 1px #002147;
border-right:solid 1px #002147;
border-left:solid 1px #002147;
}
Upvotes: 0
Views: 1918
Reputation: 3363
<div class='grid_24'>
<div class='logo left'></div>
<div class= 'searchPanel right'></div>
<div class= 'clear'></div>
</div>
.left{float:left},
.right{float:right}
Upvotes: 1
Reputation: 1956
Try setting a float:right; to the searchContainer! You should remove the margin-right: 50%; in the submit as well. If you have a fixed width layout you could also use absolute position for the searchContainer.
Upvotes: 1
Reputation: 2219
Why you dont use the grid?
<div class="container_24">
<div class="grid_24">
<div id="banner" class="grid_12 alpha"></div>
<div id="searchContainer" class="grid_12 omega">
<form>
<input id="field" name="q" type="text"/>
<div id="delete"><span id="x">X</span></div>
<input id="submit" name="submit" type="submit" value="Search" />
</form>
</div>
</div>
<div class="clear"></div>
</div>
Upvotes: 1