2017-08-09 75 views
-1

我希望有一个下拉菜单从“处理选项卡与鼠标悬停。”这将是理想的,如果“treatments.html”可能只是一个按钮,而不是一个链接下拉菜单在CSS /样式

1)菜单栏保持在网页 2)治疗选项卡具有下拉选项 3)治疗变得按钮,而不是链接的顶部粘

HTML

<html> 
<head> 

<meta name="viewport" content="width=device-width, initial-scale=1.0"> 

<link rel="stylesheet" type="text/css" href="UL.css"> 

<title>Home</title> 

<div class="parallax"></div> 

</head> 

<div class="stripes"> 
<body> 

<div class="navbar"> 
    <a href="contact-us.html" target="_top">Contact Us</a> 
    <a href="products-gifts.html" target="_top">Products & Gifts</a> 
    <a href="treatments.html" target="_top">Treatments</a> 
    <a href="home.html" target="_top">Home</a> 
</div> 

<div class="main"> 

<h1>Welcome to Undercover Laser</h1> 

</div> 

</body> 
</div> 

</html> 

CSS

.parallax { 
     background-image: url("images/IMG_5026.jpg"); 
     min-height: 680px; 
     background-attachment: fixed; 
     background-position: center; 
     background-repeat: no-repeat; 
     background-size: cover; 
     } 

body { 
    margin:0; 
    } 

.stripes { 
     background-image: url("images/stripes.jpg"); 
     background-size: cover; 
     background-repeat: no-repeat; 
     } 

.navbar { 
overflow: hidden; 
background-color: rgba(49,49,49,0.85); 
position: fixed; 
top: 0; 
width: 100%; 
float: right; 
font-family: Helvetica, sans-serif; 
} 

.navbar a { 
float: left; 
display: block; 
color: #f2f2f2; 
text-align: center; 
padding: 14px 16px; 
text-decoration: none; 
font-size: 15px; 
float: right; 
} 

.navbar a:hover { 
     background-color: #ff008f; 
     color: #FFFFFF; 
     } 

.main { 
padding: 16px; 
margin-top: 30px; 
height: auto; 
} 

h1 { 
font-family: Helvetica, sans-serif; 
font-size: 75px; 
color: #FF008F; 
text-align: center; 
} 

h2 { 
font-family: Caslon, serif; 
font-size: 40px; 
font-weight: bold; 
color: #000000; 
margin-left:50px; 
} 

p { 
font-family: Caslon, serif; 
color: #000000; 
margin-left: 50px; 
margin-right: 50px; 
font-size: 18px; 
} 
+1

问题是什么?它不工作? – Nisarg

+0

@NisargShah唯一的问题是治疗选项卡。我有其他的HTML文件,我想附加在下拉菜单中,只有该治疗选项卡 –

回答

1

你想要的是当鼠标悬停一个有子相关页面的标签时,它显示在它下面,用户可以点击子页面(Childs)。 你真的不必做一个标签按钮,而其他不是!!

要做到这一点,你必须使用定位如下: - 父容器是锚(链接)与position: relative;

  • 儿童<div>

position: absolute; bottom: 0; left: 0;

这将使标签下方的<div>