I've been suffering from several float problems. I want a Title on the left to be aligned vertically with several links on the right. However with my code the Title is lower than the links. I've tried putting display: inline in every place but to no avail. Here is my code:
Expand|Select|Wrap|Line Numbers
- <style type="text/css">
- /* =INITIAL
- /* Neutralize styling:
- Elements we want to clean out entirely: */
- html, form, fieldset, body {
- margin: 0;
- padding: 0;
- font: 80%/130% Verdana, Arial, Helvetica, sans-serif;
- }
- /* Neutralize styling:
- Elements with a vertical margin: */
- pre, blockquote, ul, ol, dl, address {
- margin: 1em 0;
- padding: 0;
- }
- p {
- padding: 0;
- margin-top: 1em;
- margin-bottom: 0em;
- margin-left:0;
- margin-right:0;
- }
- /* Apply left margin:
- Only to the few elements that need it: */
- dd, blockquote {
- margin-left: 1em;
- }
- /* Miscellaneous conveniences: */
- form label {
- cursor: pointer;
- }
- fieldset {
- border: none;
- }
- input, select {
- font-size: 100%;
- }
- textarea {
- font-size: 100%;
- margin:2px;
- padding:2px;
- }
- #page {
- background: grey;
- text-align:center;
- }
- #box {
- width: 700px;
- border: 2px solid black;
- border-width: 0px 2px;
- margin: 0 auto;
- padding: 0;
- }
- #topbar {
- width: 690px;
- background: #336633;
- text-align: right;
- padding: 5px;
- }
- .toplinks {
- margin: 0 0;
- padding: 0px;
- display: inline;
- }
- .toplinks ul {
- list-style-type: none;
- margin: 0;
- }
- .toplinks ul li {
- display: inline;
- list-style-type: none;
- padding: 2px;
- }
- #header {
- left:100px;
- background: #FFF;
- background-image: url('pattern3.jpg');
- width: 700px;
- padding: 0px;
- margin-top:0em;
- height: 100px;
- clear: both;
- }
- </style>
- <body id="page">
- <div id="box">
- <div id="topbar">
- <div class="toplinks">
- <ul>
- <li>Link 1</li>
- <li>Link 2</li>
- </ul>
- </div>
- <h2>Title</h2>
- <div style="clear:both;"></div>
- </div>
- <div id="header">
- Logo here with image..bg image
- <div id="underlinemenu">
- <ul>
- <li><a href="" title="Home">Home</a></li>
- <li><a href="" title="link 2">Link 2</a></li>
- <li><a href="" title="link 3">Link 3</a></li>
- <li><a href="" title="Link 4">Link 4</a></li>
- </ul>
- </div>
- </div>
- <div id="main">
- </div>
- </body>