473,395 Members | 1,539 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Horizonal list/menu problem in IE

Hello,

I've been trying to make a horzontal menu and I'm getting different results in IE. Also I've tried different ways of positioning and was wondering what is the best way.

Underneath is the code for the html and CSS of the menu. I have also attached images of what I mean by different results, hover over them to see.

Firefox 3 (works fine):


Opera 9.51 (works fine):


IE 7 (Changes sizes etc):



CSS:
Expand|Select|Wrap|Line Numbers
  1. /***********************Main navigation Menu *************************/
  2.  
  3. div.navbar {
  4.     padding:10px 2px 0px 6px;
  5.     height:28px;
  6. }
  7.  
  8.  #nav ul {
  9.     list-style-type:none;
  10.     padding:0;
  11.     margin:0 auto;
  12. }
  13.  
  14. #nav li {
  15.     display:inline;
  16. }
  17.  
  18. #nav a {
  19.     background-color:black;
  20.     color:white;
  21.     border:1px solid white;
  22.     padding:.4em 2em;
  23.     text-decoration:none;
  24.     font-variant:small-caps;
  25. }
  26.  
  27.  
  28. #nav a:hover {
  29.     background-color:#1a1a1a;
  30.     filter:alpha;
  31.     opacity:20%;
  32. }
  33.  
  34. #nav a:active {
  35. background-color:#262626;
  36. }
  37.  
HTML
Expand|Select|Wrap|Line Numbers
  1. <div class="navbar">                                                  
  2.  
  3.     <div id="nav">    
  4.      <ul>
  5.      <li><a href="http://www.trance.nu">home</a></li>
  6.      <li><a href="http://www.trance.nu">charts</a></li>
  7.      <li><a href="http://www.trance.nu">blog</a></li>
  8.      <li><a href="http://www.trance.nu">bio</a></li>
  9.      <li><a href="http://www.trance.nu">web design</a></li>
  10.      <li><a href="http://www.trance.nu">web design</a></li>
  11.         </ul>
  12.     </div>
  13. </div>
  14.  
Thanks for any help.

Andrew
Aug 28 '08 #1
10 2047
You can now view it at: www.andyboyjlm.obxhost.net


Also someone may be able to tell me why a scrollbar has been added to the browser now that I've uploaded it to a host - I had no scrollbar before and I don't want one unless I incorporate it myself.
Aug 28 '08 #2
David Laakso
397 Expert 256MB
You can now view it at: www.andyboyjlm.obxhost.net
Also someone may be able to tell me why a scrollbar has been added to the browser...
Good idea to validate the markup and CSS, to also check the page with and without +2 font-scaling in Safari, Opera, and Firefox; and, at text-size "largest" with font-sizes ignored (when setting frozen-fonts) in IE/6 & IE/7; and to check the page in a short window in all above browsers before posting.
Aug 28 '08 #3
Was that answer just relating to my 2nd post then?

You're going a bit too fast for me here. I'm new, so frozen fonts, font sizes ignored and largest doesn't mean much to me.

I've checked in 3 browsers as you can see, and I've resized them to simulate smallers resolutions etc, which are all good in 1024x768. Anything smaller I'm not bothered about at the moment - I'm just experimenting. I've held control in and scaled a couple of times up with my mouse if that's what you mean by font scaling.

Otherwise I'm not quite sure what you're on about.
Aug 28 '08 #4
Sorry AJM Project,

but I think in this case IE7 does he's work fine, because he starts top and bottom padding in the middle of text. The others from the bottom of text. I reduced your code to what is necessary to show what I mean

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title>Menu's</title>
  5. <style type="text/css">
  6. div.navbar {
  7.     height:30px;
  8.     background-color:#767676;
  9.     background-repeat:repeat-x;
  10.     margin-left:1px;
  11. }
  12. </style>
  13. </head>
  14. <body>
  15.   <div class="navbar">                                                  
  16.     Text<BR>
  17.   </div>
  18. </body>
  19. </html>
  20.  
The behavior is for IE7 and FF3 the same. But if you add "padding:20px;" you can see what I mean In IE7 the text is centered between top and bottom. FF3 adds a slight padding at the bottom.

I found a quick and dirty solution: Add after the padding "padding-start=0pt" without a semicolon at the end. It's normally used in XML, I believe.

Another possibility is, because you give navbar a fixed height, give the navbuttons also a fixed height.

I hope, I could help you.
Aug 28 '08 #5
David Laakso
397 Expert 256MB
Was that answer just relating to my 2nd post then?.
Yes. You have to start somewhere. Validate the markup and the CSS.
Aug 28 '08 #6
Was that answer just relating to my 2nd post then?
Hello AJM-Project,

I am also again "Confused? Bewildered? Stuck?".

Sunny1957
Aug 29 '08 #7
I'm sorry sunny but I don't quite understand what you're trying to say. I tried what I think you said and there is no difference.

David, thanks again. Hopefully I can validate it and then you or someone else will help.
Aug 29 '08 #8
David Laakso
397 Expert 256MB
David, thanks again. Hopefully I can validate it and then you or someone else will help.
Good. Once validated, I think you'll need to count on someone else to help. I pretty much summed up my opinion in reply to your thread of Aug 21 subject line: "Div doesn't expand for content, help?"
Aug 29 '08 #9
David Laakso
397 Expert 256MB
Regarding the list issue, for whatever reason neither IE/6 or IE/7 is capable of adjusting the glyph height of the small-caps in the last two links. An /ugly/ workaround is to assign a line-height (only px line-height works in this situation) for the IEs (see the conditional comments). Additionally, a little different structure for the list may work better all around.

Please see on-line example here:
horizontal list

Markup and CSS for forum archives below.

FWIW, personally I'd reset to text-transform: uppercase; and delete the small-caps call and the px line-height hack for it...

Expand|Select|Wrap|Line Numbers
  1.  
  2. CSS
  3.  
  4. <style>
  5. html, body {
  6. margin : 0;
  7. padding : 0;
  8. }
  9. body {
  10. font : 100% serif;
  11. text-align : center;
  12. }
  13. #nav {
  14. background : #ddd;
  15. margin : 6px 0 0 0;
  16. padding : 5px 0;
  17. line-height: 1.75;
  18. }
  19. #nav ul {
  20. text-align : center;
  21. padding : 5px 0;
  22. margin : 0;
  23. background-color : #ddd;
  24. color : white;
  25. width : 100%;
  26. }
  27. #nav ul li {
  28. display : inline;
  29. padding : 5px 0;
  30. }
  31. #nav ul li a {
  32. padding : 5px 10px;
  33. background : red;
  34. color : #fff;
  35. text-decoration : none;
  36. border : 1px solid #fff;
  37. font-variant : small-caps;
  38. }
  39. #nav ul li a:hover {
  40. background-color : fuchsia;
  41. color : white;
  42. }
  43.  
  44. </style>
  45.  
  46. <!--[if lte IE 7]>
  47. <style>
  48. /* style for IE/6 */
  49. #nav {padding: 0; }
  50. #nav ul {line-height:18px;}
  51. #nav ul li a {zoom: 1;}
  52. </style>
  53. <![endif]-->
  54.  
  55. <!--[if IE 7]>
  56. <style>
  57. /* style for IE/7 */
  58. #nav {padding: 0; }
  59. #nav ul {line-height:18px;}
  60. #nav ul li a {zoom: 1;}
  61. </style>
  62. <![endif]-->
  63.  
  64.  
  65. HTML
  66. <div id="nav">
  67. <ul id="navlist">
  68. <li><a href="http://www.trance.nu">home</a></li>
  69. <li><a href="http://www.trance.nu">charts</a></li>
  70. <li><a href="http://www.trance.nu">blog</a></li>
  71. <li><a href="http://www.trance.nu">bio</a></li>
  72. <li><a href="http://www.trance.nu">web*design</a></li>
  73. <li><a href="http://www.trance.nu">web*design</a></li>
  74. </ul>
  75. </div>
  76.  
  77.  
  78.  
  79.  
  80.  
Aug 29 '08 #10
Thanks again David, I appreciate it greatly.

It seems the the small variant was indeed the culprate. The problem is sorted now with the following code..

Expand|Select|Wrap|Line Numbers
  1. div.navbar {
  2.     background-color:green;
  3.     padding:5px 0;
  4.  
  5. }
  6.  
  7.  #nav ul {
  8.     list-style-type:none;
  9.     padding:5px 0;
  10.     margin: 0 0 0 15px;
  11. }
  12.  
  13. #nav li {
  14.     display:inline;
  15. }
  16.  
  17. #nav a {
  18.     background-color:red;
  19.     color:white;
  20.     border:1px solid white;
  21.     padding:.5em 2em;
  22.     text-decoration:none;
  23.     text-transform:uppercase;
  24. }
  25.  
Re the scrollbar prob - my webhost had added extra code and divs to the bottom of my site. I'm trying to consult them about it; I just didn't think this would be the case, hense the question I asked.

Again thank you, hopefully next time I post I will have validation sufficient.

So far my knowledge of HTML and CSS is mainly from reading the book "Sam's Teach Yourself HTML & CSS in 24 Hours", a great book. But obviously it's only beginner level. I have my sites on more advanced books now so hopefully they will help me out with better validation also.

Cheers.
Aug 30 '08 #11

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

Similar topics

9
by: Faz | last post by:
Hi I'm having some real trouble with a header I have created within a container. I have two problems; firstly the menu (a horizontal UL) will not centre within the surrounding header, despite...
1
by: Sakharam Phapale | last post by:
Hi All, How to show dropdown list of menu items just like click on Parent menu. For example, Edit (Parent menu) Cut (child menu) Copy (child menu) Paste (child menu)
0
by: Octopus0 | last post by:
Dear all, I developed web application VB.net , and i had an Radio Button List. the problem is the Horizonal bar of the Radio button list dosen't work it apperars as disable. i add to the HTML...
1
by: Aad vd Naad | last post by:
Hi, I have create a dropdown menu which looks as expected in Safari (Mac). Viewing it in FF (Mac) or IE6 (Windows) it's a bit messed up. It also seems that when the top level links are clicked...
4
by: zacks | last post by:
Most applications whose purpose is to work with various types of files implement a "Most Recent Files" list, where the last, say, four files accessed by the application can quickly be re-opened by...
16
by: stevedude | last post by:
CSS newbie again. I have a problem trying to get coffee mug images within anchor tags to center with my link text for a vertical list menu. If I use the horizontal/vertical properties of...
5
by: jmartmem | last post by:
Greetings, I am using Dreamweaver CS3 to design an ASP page that contains an Insert Record Form. Within this form are two list/menu form fields that I would like to "synchronize". In other words,...
10
by: lenzie | last post by:
I am having a very odd problem with a website I run. The menus have recently been changed to use javascript and some people are reporting that when they first use the site, Instead of a nicely...
5
by: jerry101 | last post by:
Hi, I've been working on a horizontal drop down menu today, and I can get it to display perfectly in everything bar IE6. Basically instead of them lining up horizontally, they line up...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.