Table of Contents
Reply to discussion (solution)
Home Web Front-end HTML Tutorial The same code, why are the results different? ? ? _html/css_WEB-ITnose

The same code, why are the results different? ? ? _html/css_WEB-ITnose

Jun 24, 2016 pm 12:24 PM

tomcat HTML jsp

I wrote a navigation menu with css. With the same code, I deployed the file to the tomcat server and opened it with a browser. The result is


I am in Open the desktop directly: the result is:



I don’t know the reason, that is, the result displayed in the submenu in Figure 1 does not correspond to the main menu. Figure 2 is correct. Please enlighten me.

The original code is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>纯CSS实现的多级下拉导航菜单5,可设定下拉菜单宽度mobanwang.com</title><style type="text/css">/* for this demo only */#backgroundHolder { width:750px; height:490px; padding-top:10px; background:url(ulmulti5/pic.jpg); margin:0 auto; text-align:center; }/* ----------------------------------------------------------------------------	*//* default styling */.nav, .nav ul { list-style-type:none; margin:0; padding:0; }.nav a { text-decoration:none; }.nav { font-family: arial, sans-serif; font-size:12px; width:460px; margin:0 auto; text-align:left; }/* style the links *//* needs a background for IE6 - can be a color or a transparent gif */.nav a { background:url(trans.gif); filter: alpha(opacity=90); opacity:0.9; }/* style the <b> element so that is does not affect the size of the link */.nav a b { color:#fff; font-weight:normal; display:block; padding:5px 10px; margin-right:1px; }.nav a:hover b { color:#000; cursor:pointer; border-left:2px solid #eee; }.nav .fly .main b { background: transparent url(ulmulti5/arrow.gif) no-repeat right 9px; }.nav .down b { background: transparent url(ulmulti5/arrow2.gif) no-repeat right 11px; }/* for the offset left dropdown and flyout */.nav .nav4 ul b { text-align:right; }.nav .nav4 ul .main b { background: transparent url(ulmulti5/arrow3.gif) no-repeat left 9px; text-align:right; }.nav .nav4 ul a:hover b { border-left:0; border-right:2px solid #eee; }/* HEIGHT */.nav ul ul { top:-25px; } /* position the top of the flyout sub menus */.nav ul ul.two { top:-40px; } /* position the top of the flyout sub menus *//* WIDTH change this WITH CARE to suit your requirements */ /* FOR NAV1 */.nav1 { width:80px; }.nav1 a { width:80px; }.nav1 a b { background-color:#764; }/* FOR NAV2 */.nav2, .nav2 a { width:100px; }.nav .nav2 a b, .nav .nav2 .fly a b { background-color:#887; }.nav2 ul li { max-width:100px; }.nav2 ul a { width:130px; }.nav2 ul ul { left:130px; }.nav2 a { margin-right:-99px; }.nav2 ul a { margin-right:-129px; }/* FOR NAV3 */.nav3, .nav3 a { width:100px; }.nav .nav3 a b, .nav .nav3 .fly a b { background-color:#775; }.nav3 ul li { max-width:100px; }.nav3 ul a { width:120px; }.nav3 ul ul { left:120px; }.nav3 a { margin-right:-99px; }.nav3 ul a { margin-right:-119px; }/* FOR NAV3 */.nav4, .nav4 a { width:80px; }.nav .nav4 a b, .nav .nav4 .fly a b { background-color:#675; }.nav4 ul li { max-width:80px; }.nav4 ul a { width:110px; }.nav4 ul { left:-30px; } /* position the dropdown left */.nav4 ul ul { left:auto; right:110px; }  /* position the flyouts left */.nav4 a { margin-right:-79px; }.nav4 ul a { margin-right:-109px; }/* FOR NAV5 */.nav5 { width:100px; }.nav5 a { width:100px; }.nav5 a b { background-color:#a54; margin-right:0; }/* ----------------------------------------------------------------------------	*/ /* DO NOT CHANGE ANYTHING BELOW */.nav li { float:left; } /* fixes several IE related bugs, and allows for clearing */.nav ul { float:left; position:relative; z-index:20; } /* necessary for float drop and to stack the <ul>s */.nav ul li { clear:left; } /* must clear the floated list item inside sublist */.nav a { position:relative; display:block; } /* needs to have a position, to be above the rest */.nav a.main { float:left; /* necessary for float drop */ margin-top:10000px; } /* bring the top level links back into view */.nav .drop, .nav .fly { margin-top:-10000px; } /* hide the sub links and their containers, opera has low upper limits */.nav ul { margin-bottom:-5000px; } /* avoid any interaction between the subs, can be any large size *//* The bit that does ALL the work to bring the sub menus into view */.nav a:hover, .nav a:focus, .nav a:active { margin-right:0; z-index:10; outline:0; }.nav a:hover b, .nav a:focus b, .nav a:active b { color:#000; cursor:pointer; border-left:2px solid #eee; }.nav .nav4 ul a:hover b, .nav .nav4 ul a:focus b, .nav .nav4 ul a:active b { border-left:0; border-right:2px solid #eee; }.nav2 ul a:hover, .nav2 ul a:focus, .nav2 ul a:active { margin-right:-30px; z-index:10; outline:0; }.nav3 ul a:hover, .nav3 ul a:focus, .nav3 ul a:active { margin-right:-20px; z-index:10; outline:0; }.nav4 ul a:hover, .nav4 ul a:focus, .nav4 ul a:active { margin-right:-30px; z-index:10; outline:0; }/* OPERA fix */.nav ul:hover, .nav ul ul:hover { clear:left; } /* to stop int/* ----------------------------------------------------------------------------	*/</style> </head><body><div id="backgroundHolder">  <ul class="nav">    <li class="nav1 drop"><a class="main" href="#url"><b>Home</b></a></li>    <li class="nav2 drop"><a class="main down" href="#url"><b>Equipment</b></a>    </li>    <li class="nav3 drop"><a class="main down" href="#url"><b>3</b></a>      <ul>        <li class="fly"><a class="main" href="#url"><b>3.1</b></a>          <ul>            <li><a href="#url"><b>3.11</b></a>            </li>            <li><a href="#url"><b>3.12</b></a></li>            <li><a href="#url"><b>3.13</b></a></li>            <li><a href="#url"><b>3.14</b></a></li>            <li><a href="#url"><b>3.15</b></a></li>            <li><a href="#url"><b>3.16</b></a></li>          </ul>        </li>         <li class="fly"><a class="main" href="#url"><b>3.2</b></a>           <ul>                <li><a href="#url"><b>3.21</b></a></li>                <li><a href="#url"><b>3.22</b></a></li>                <li><a href="#url"><b>3.23</b></a></li>                <li><a href="#url"><b>3.24</b></a></li>                <li><a href="#url"><b>3.25</b></a></li>          </ul>        </li>      </ul>    </li>    <li class="nav4 drop"><a class="main down" href="#url"><b>Outlets</b></a>    </li>    <li class="nav5 drop"><a class="main" href="#url"><b>Privacy Policy</b></a></li>  </ul></div></body></html>
Copy after login

Reply to discussion (solution)

Copy it and check it out, no problem, what are you using? Browser problem?


I am using ie8, built a project on myeclipse, and set up an SSH environment, then copied the html file to the built project, started the server, opened it from the browser, and it appeared Error as above

Copy it and check it out, no problem. What browser are you using?

Thank you, it has been solved. It was a code problem, the writing was too messy

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1672
14
PHP Tutorial
1277
29
C# Tutorial
1257
24
HTML: The Structure, CSS: The Style, JavaScript: The Behavior HTML: The Structure, CSS: The Style, JavaScript: The Behavior Apr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML, CSS, and JavaScript: Web Development Trends The Future of HTML, CSS, and JavaScript: Web Development Trends Apr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

The Future of HTML: Evolution and Trends in Web Design The Future of HTML: Evolution and Trends in Web Design Apr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative Overview HTML vs. CSS vs. JavaScript: A Comparative Overview Apr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML vs. CSS and JavaScript: Comparing Web Technologies HTML vs. CSS and JavaScript: Comparing Web Technologies Apr 23, 2025 am 12:05 AM

HTML, CSS and JavaScript are the core technologies for building modern web pages: 1. HTML defines the web page structure, 2. CSS is responsible for the appearance of the web page, 3. JavaScript provides web page dynamics and interactivity, and they work together to create a website with a good user experience.

HTML: Is It a Programming Language or Something Else? HTML: Is It a Programming Language or Something Else? Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

Beyond HTML: Essential Technologies for Web Development Beyond HTML: Essential Technologies for Web Development Apr 26, 2025 am 12:04 AM

To build a website with powerful functions and good user experience, HTML alone is not enough. The following technology is also required: JavaScript gives web page dynamic and interactiveness, and real-time changes are achieved by operating DOM. CSS is responsible for the style and layout of the web page to improve aesthetics and user experience. Modern frameworks and libraries such as React, Vue.js and Angular improve development efficiency and code organization structure.

What is the difference between <strong>, <b> tags and <em>, <i> tags? What is the difference between <strong>, <b> tags and <em>, <i> tags? Apr 28, 2025 pm 05:42 PM

The article discusses the differences between HTML tags , , , and , focusing on their semantic vs. presentational uses and their impact on SEO and accessibility.

See all articles