0

Below HTML Displays Menu in same line for FF latest version & Google Crome browsers but in IE9 it it show them in separate lines.

I want menu to be display in one line. I am not sure what i should do to fix this i tried several properties but didn't work as it works in FF & Crome. Any help in this would be appreciated

<html>
<head>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript">
    $(document).ready(function()
{
  $("p").click(function()
{
    $(this).hide();
  });
});
 </script>

<style>
.test
{
    background-color: #B4984E;    
    border: 1px #ffffff solid;
    color: #fff;       
 line-height: 1.35em;
    padding: 4px 23px;
    text-decoration: none;      
  /* white-space: nowrap; display: block;*/       
 display: inline-block; 
    cursor:pointer;    
}    
</style>    
</head>
<body>    
<div class="test" href="http://Default.aspx?PageId=3&Language=en-US">HOME</div>    
<div class="test" href="http://PageId=5&Language=en-US">PROFILE</div>    
</body>
</html>

Update: I cant use float:left in this one

0

2 Answers 2

2

Most important thing: <div>s are not links, and do not have hrefs. Use the anchor tag: <a>.

Next most important thing: You need a doctype or your page will be rendered in "quirks mode" (in other words, very badly). The standard doctype these days is the html5 doctype, which is simply:

<!doctype html>

Put this at the top of your page, before the <html> tag.

That alone might solve your issue, but as a wild guess you might want to try float:left instead of display:inline-block (although that should already work).

Sign up to request clarification or add additional context in comments.

1 Comment

I agree with you Actually i am tried us string builder in C# to build a string similar to <div class="test" onclick="location.href='example.com';" > hello</div> BUT string builder generates I agree with you Actually i am trying to string builder in C# to build a string similar to <div class="test" onclick='location.href='example.com';' > hello</div> which doesn't work NOTICE the difference after onclick=' its ads single code rather than double quote somehow which doesn't work properly. I will implement other part of your suggestion & see if it works. Thanks
0

Give your divs that you want to be next to each other float:left properties and give them widths.

2 Comments

I want to achieve this without using float:left, float will resolve but i cant use this...
You're probably going to get a bunch of answers telling you to use floats. Maybe you should let everyone know in your description that you do not want to use floats and why?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.