473,473 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

CSS float vertical alignment

6 New Member
hey
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
  1. <style type="text/css">
  2.  
  3. /* =INITIAL 
  4.  
  5. /* Neutralize styling: 
  6.    Elements we want to clean out entirely: */
  7. html, form, fieldset, body {
  8.         margin: 0;
  9.         padding: 0;
  10.         font: 80%/130% Verdana, Arial, Helvetica, sans-serif;
  11. }
  12.  
  13. /* Neutralize styling: 
  14.    Elements with a vertical margin: */
  15. pre, blockquote, ul, ol, dl, address {
  16.         margin: 1em 0;
  17.         padding: 0;
  18. }
  19.  
  20. p {
  21. padding: 0;
  22. margin-top: 1em;
  23. margin-bottom: 0em;
  24. margin-left:0;
  25. margin-right:0;
  26. }
  27. /* Apply left margin:
  28.    Only to the few elements that need it: */
  29. dd, blockquote {
  30.         margin-left: 1em;
  31. }
  32.  
  33. /* Miscellaneous conveniences: */
  34. form label {
  35.         cursor: pointer;
  36. }
  37. fieldset {
  38.         border: none;
  39. }
  40. input, select {
  41.         font-size: 100%;
  42.  
  43. }
  44. textarea {
  45.      font-size: 100%;
  46.         margin:2px;
  47.         padding:2px;
  48. }
  49.  
  50.  
  51. #page {
  52. background: grey;
  53. text-align:center;
  54. }
  55.  
  56.  
  57. #box {
  58.     width: 700px;
  59.     border: 2px solid black;
  60.     border-width: 0px 2px;
  61.     margin: 0 auto;
  62.     padding: 0;
  63.  
  64. }
  65.  
  66.  
  67. #topbar {
  68. width: 690px;
  69. background: #336633;
  70. text-align: right;
  71. padding: 5px;
  72.  
  73. }
  74.  
  75.  
  76. .toplinks {
  77. margin: 0 0;
  78. padding: 0px;
  79. display: inline;
  80. }
  81.  
  82. .toplinks ul {
  83. list-style-type: none;
  84. margin: 0;
  85.  
  86. }
  87.  
  88. .toplinks ul li {
  89. display: inline;
  90. list-style-type: none;
  91. padding: 2px;
  92.  
  93. }
  94.  
  95. #header {
  96. left:100px;
  97. background: #FFF;
  98. background-image: url('pattern3.jpg');
  99. width: 700px;
  100. padding: 0px;
  101. margin-top:0em;
  102. height: 100px;
  103. clear: both;
  104. }
  105. </style>
  106.  
  107. <body id="page">
  108. <div id="box">
  109.  
  110. <div id="topbar">
  111. <div class="toplinks">
  112.  
  113. <ul>
  114. <li>Link 1</li>
  115. <li>Link 2</li>
  116. </ul>
  117. </div>
  118.  <h2>Title</h2>
  119. <div style="clear:both;"></div>
  120. </div>
  121. <div id="header">
  122. Logo here with image..bg image
  123. <div id="underlinemenu">
  124. <ul>
  125. <li><a href="" title="Home">Home</a></li>
  126. <li><a href="" title="link 2">Link 2</a></li>
  127. <li><a href="" title="link 3">Link 3</a></li>
  128. <li><a href="" title="Link 4">Link 4</a></li>
  129. </ul>
  130. </div>
  131. </div>
  132. <div id="main">
  133.  
  134. </div>
  135. </body>
  136.  
  137.  
ive been using the additional div with the clear:both just to make sure the parent div encompasses both..once properly aligned i wont need it..hopefully haha
Aug 29 '06 #1
3 15634
cbjewelz
6 New Member
here is a pic:

Aug 29 '06 #2
jumpfroggy
1 New Member
I know this is old, and I'm sure you've found something by now, but I'd recommend setting the Title to "float:left;" and the links/list on to "float:right;". That way they'll be mostly on the same line. I think because you have the links as inline, but the title is a block element (<h1>), they wont be on the same line.
Feb 16 '07 #3
AricC
1,892 Recognized Expert Top Contributor
Try text-align: left
Feb 16 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: abracad | last post by:
Hi Is it possible to vertically align an image in the middle of a DIV of fixed height?
1
by: Kenneth | last post by:
Okay, I've been scouring Google for hours looking for a solution to this problem, but as of yet I can't find one. XHTML Transitional seems to specify that I can no longer set a table's height to...
15
by: thomas.mertes | last post by:
For a hash function I want to reinterpret the bits of a float expression as unsigned long. The normal cast (unsigned long) float_expression truncates the float to an (unsigned long) integer. ...
9
panachepad
by: panachepad | last post by:
I arrived here from a websearch that found this thread from your archives: http://www.thescripts.com/forum/thread97805.html It helped me to understand that I am on the right track, but I still have...
6
by: Andy Mabbett | last post by:
Please can someone remind me of the most elegant fix for the way Firefox fails to vertically align cell content by default? For example, the second event on: ...
11
by: C.W.Holeman II | last post by:
I what to hide an input element and the following text. I have the selector for the input working and just need to grab the text following it. CSS: form{ display:table; text-align:center; }
8
by: ayamopamo | last post by:
Hi- I am trying to center a web page. It seems like this should be very simple to do, but apparently it isn't my day. I have successfully centered the background by calling it in the css body tag:...
13
by: Bill | last post by:
Hi How can I have IE7 act correctly on that ? The rules make the link text go down when hovered. It works in FF , I had to add a hard space right after the LI tag to have OP9 work but I can't...
5
by: asc4john | last post by:
I have <ul<liitem text <spancount </span</li><liitem text <spancount </span</li</ul> I want the span to right in the LI, but when I use float:right on the SPAN it winds-up appearing in the next LI...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.