On my website bbhydraulics.com it does show the menu in internet explorer.

here is the top part where I think the problem is:

<?xml version="1.0">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

Is that the right code?

Dani AI

Generated

Nice catch by on the missing <body> and by noting the <nav> element. A few extra fixes make IE behave: put the doctype at byte 0 (nothing before it), explicitly declare your encoding, and make sure <head> is closed before <body>. Pages that have anything before the doctype can fall into quirks mode in IE, and the missing structure makes scripts that look in <body> fail. Also add a charset to resolve the validator warning. (developer.mozilla.org)

If you still need to support IE8 and below, load the HTML5 shiv early in the head so IE knows about <nav> and friends, and give the new elements a block display so your menu can be styled.

<head>
  <meta charset="utf-8">
  <!--[if lt IE 9]>
    <script src="/js/html5shiv.min.js"></script>
  <![endif]-->
  <style>
    header, nav, section, article, aside, footer { display:block; }
  </style>
</head>

Place the conditional script before your CSS so printing and layout work consistently. (github.com)

If you prefer to keep XHTML 1.0, serve it as normal text/html and omit the <?xml ...?> prolog when doing so; XHTML sent as text/html is parsed as HTML (not XML), and the XML declaration is unnecessary and can lead to legacy IE mode quirks. Optionally add <meta http-equiv="X-UA-Compatible" content="IE=edge"> near the top of <head> to prevent Compatibility View from forcing an older document mode. (w3.org)

Recommended Answers

All 10 Replies

also I did a markup validation and it said this:

    Warning No Character Encoding Found! Falling back to UTF-8.

    None of the standards sources gave any information on the character encoding labeling for this document. Without encoding information it is impossible to reliably validate the document. As a fallback solution, the "UTF-8" encoding was used to read the content and attempt to perform the validation, but this is likely to fail for all non-trivial documents.

    Read the FAQ entry on character encoding for more details and pointers on how to fix this problem with your document.

    Info No Character encoding declared at document level

    No character encoding information was found within the document, either in an HTML meta element or an XML declaration. It is often recommended to declare the character encoding in the document itself, especially if there is a chance that the document will be read from or saved to disk, CD, etc.

    See this tutorial on character encoding for techniques and explanations.

If you are starting to develop this site, why not go with an HTML5 Doctype? This doesnt mean that you have to include new elements introducted in HTML5.

The HTML5 page structure is as follows...

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Example document</title>
    <link href="stylesheet.css" rel="stylesheet"/>
    <script src="script.js"></script>
  </head>
  <body>
    <p>Example paragraph</p>
  </body>
</html>

I have already design the website.
I was on
and I use the xhtml 1.0 strict. I got the first one to work but it printed the web address. so I try the other ones and now none of them work period.

Ok, so I took a look at the source code of your website. My first suggestion to you is to clean up your page structure.

For example, you didnt close the <head> element. You didnt include the <body> element and didnt close the <html> element either.

This is going to cause different browsers to render the page differently. Browsers will try to render the elements as best they can, but it is best to follow standards.

In your case, if you are trying to apply a strict doctype, these things that I mentioned are very important.

again, I would suggest to you look at the sample structure that I provided earlier. I didnt see any specific HTML5 elements on your page so the structure I provided will work perferctly and be supported accross the different browsers.

Just taking a quick peek, you're using the HTML 5 Enabler for IE which searches the body of the document for HTML 5 tags. You never actually end the page header and start the body so the script has nothing to search hence why it won't convert your HTML 5 tags in IE

,

The reference to the HTML5Shiv on that page is not being used. The DOCYTPE is not set for HTML5, and there are no HTML5 elements on the page. If you read the previous posts, the OP is not interested in the HTML5 structure, but I was suggesting that since the page can be easily fixed and be HTML5 compliant and ready.

All I had to do is add a <body> tag and that did it. Thanks JorgeM for pointing that out.

,

He is using the <nav> tag for his navigation menu which is an HTML 5 element and is only supported in IE9 and the HTML5Shiv is being used for earlier versions of IE. In the end we made the same suggestion I just didn;t refresh the page after looking at his code so I didn't see you had provided the same answer prior to me

I didnt see the <nav> element. thanks for pointing that out.

This thread can be set to solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.