Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
104 views
in Technique[技术] by (71.8m points)

html - chrome dropdown menu compatibility problem

it works fine with all browsers except chrome, while real-preview using Dreamweaver seems fine with all of them, but when uploading it to the server the problem shows up in chrome only. tried to change the inline/block tag. the display: none/block tag everything and still can not solve it. is it a CSS related thing or javascript or what? the dropdown menu works fine on every browser except Chrome

html, body {
    margin: 0px;
    padding: 0px;
    width: 100%;
}

ul > li{
    list-style-type: none;
    display: inline-block;
}


.grid-container {
    display:grid;
}

a {
    display: block;
}

#upper-bar {
    background-color: #00A2CB;
    color: white;
    font-weight: bold;
    font-family: sans-serif;
    padding-left: 50px;
    padding-right: 50px;
}

div[id="upper-bar"] a {
    color: white;
    padding: 5px;
}

#lower-bar {
    font-weight: bold;
    font-family: sans-serif;
    padding-left: 70px;
    padding-right: 70px;
}

div[id="lower-bar"] a {
    color: black;
    padding: 5px;
}

.align-left {
    float:left;
}

.align-right {
    float: right;
}
li a, .dropbtn {
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

li.dropdown {
display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #00A2CB;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
}

.dropdown-content a {
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}

.dropdown-content a:hover {background-color: #008FB3;}

.dropdown:hover .dropdown-content {
  display: block;
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="css/style.css" rel="stylesheet" type="text/css">
<title>Test page</title>
</head>

<body>
    <header class="grid-container">
        <div id="upper-bar">
            <div class="align-left">
                <ul>
                    <li>|</li>
                    <li><a href="#" >ABOUT US</a></li>
                    <li>|</li>
                    <li><a href="#" >OUR SERVICES</a></li>
                    <li>|</li>
                    <li class="dropdown">
                        <a href="javascript:void(0)" class="dropbtn">HELP</a>
                        <div class="dropdown-content">
                            <a href="#">Link 1</a>
                            <a href="#">Link 2</a>
                            <a href="#">Link 3</a>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
        <div id="lower-bar">
            <div class="align-left">
                <ul>
                    <li><a href="#" ><img src="#" rel="#" alt="#"></a></li>
                    <li><a href="#" >Home</a></li>
                    <li><a href="#" >Individuals</a></li>
                    <li><a href="#" >doctors</a></li>
                    <li><a href="#" >Companies</a></li>
                </ul>
            </div>
            <div class="align-right">
                <ul>
                    <li><a href="#" >Login</a></li>
                    <li><a href="#" >Signup</a></li>
                </ul>
            </div>
        </div>    
    </header>
    <main>
    </main>
    <footer>
        
    </footer>
    
</body>
</html>
question from:https://stackoverflow.com/questions/65643062/chrome-dropdown-menu-compatibility-problem

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...