Help with displaying information using css and cinditional comments

In summary, the individual has been struggling to find a solution for displaying information in a drop down menu on Internet Explorer, despite it working fine on other browsers. They provide HTML and CSS code they have tried, but apologize for potentially asking a simple question as they are not familiar with conditional comments. They express gratitude for any help provided.
  • #1
wScott
88
0
Good evening, morning, or what-not time it is in your present proximity. I've been trying to find a way to display some information in a drop down menu in IE for the past while and haven't been able to come up with a solution, it works fine in firefox and netscape.

HTML code:

<div class='menu'>
<ul>
<li><a class='hide' id='activeLink' href='index[2].htm'>Home
<!--[if gt IE 6]>
<a id='activeLink' href='index[2].htm'>Home
<![endif]-->
<ul id='HomeSub'>
<li><a href='#'>sub</a></li>
<li><a href='#'>sub</a></li>
<li><a href='#'>sub</a></li>
</ul>
<!--[if gt IE 6]>
</a>
<![endif]-->
</a></li>

After that there is some more code that is very similar to that. Sorry if this is a simple question, haven't worked with conditional comments before.

The CSS code I tried to display it were:

.menu ul li a.hide a:hover ul {
display: block;
position: absolute;
left: 0px;}

.menu ul li a:hover ul#HomeSub {
left: -30px;
width: 100px;}
 
Technology news on Phys.org
  • #2
.menu ul li a.hide a:hover ul li { border-top: 1px solid #ccc; background: #f3f3f3; padding: 5px 0px; text-align: left;}If you could help me out with this, I would really appreciate it. Thank you!
 
  • #3


Good evening/morning/afternoon to you as well! It looks like you are trying to use conditional comments to target only Internet Explorer and display certain information in a drop down menu. Here are a few suggestions for you:

1. Make sure you are using the correct syntax for conditional comments. The correct syntax for targeting IE is "<!--[if IE]> HTML code <![endif]-->". In your code, you are using "<!--[if gt IE 6]> HTML code <![endif]-->", which is incorrect.

2. Instead of using a separate <a> tag for the drop down menu in your conditional comment, try using a <div> or <span> element. This will make it easier to target in your CSS.

3. In your CSS, instead of using "a.hide a:hover ul", try using "li:hover ul" to target the drop down menu when the list item is hovered over.

4. It may also be helpful to use the "display: none;" property in your CSS to initially hide the drop down menu, and then use "display: block;" to show it when the list item is hovered over.

I hope these suggestions help you to successfully display your information in the drop down menu in IE. Good luck!
 

Related to Help with displaying information using css and cinditional comments

1. What is CSS?

CSS stands for Cascading Style Sheets and is a language used to style and format the appearance of web pages. It allows developers to control the layout, fonts, colors, and other visual aspects of a website.

2. How do I use CSS to display information?

To display information using CSS, you can use the "display" property with a value of "block" or "inline" to determine how the element will be displayed on the page. You can also use CSS to style the font, size, and color of the text to make it more visually appealing.

3. What are conditional comments in CSS?

Conditional comments in CSS are special tags used to target specific versions of Internet Explorer. They allow developers to write code that will only be read by certain versions of IE, allowing for different styles to be applied to different versions of the browser.

4. How do I use conditional comments in my CSS code?

To use conditional comments, you can wrap your CSS code inside a special HTML comment tag that targets specific versions of IE. For example, will only be read by Internet Explorer version 9.

5. Can I use conditional comments for other browsers?

No, conditional comments are only supported by Internet Explorer. Other browsers use different methods, such as feature detection, to target specific versions or types of browsers.

Similar threads

  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
3
Views
2K
  • Programming and Computer Science
3
Replies
75
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
283
Replies
4
Views
3K
Back
Top