下拉菜单切断身体
问题描述:
我很困扰这一个。我有一个下拉菜单,当它溢出它的div时被切断。下拉菜单切断身体
在大多数情况下,我所遇到的,这是因为一些父元素具有溢出:隐藏或z-index的没有设置,但我曾经尝试都没有效果......
这是代码:
@import url(https://fonts.googleapis.com/css?family=Catamaran);
body,
html {
margin: 0;
padding: 0;
background-color: #aaf44d;
overflow: visible;
}
html {
font-family: "Catamaran", serif;
}
body {
font-family: inherit;
background-image: linear-gradient(216deg, #c8ff40, #a7eba2, #16ac2a);
}
textarea,
select,
button {
font-family: inherit;
}
#submit {
padding: 4px 10px;
background-color: #1b9c34;
border: 0 none;
cursor: pointer;
color: white;
-webkit-border-radius: 5px;
border-radius: 5px;
font-family: inherit;
font-weight: bold;
}
#submit:hover {
background-color: lightgray;
}
#submit:active {
background-color: #1b9c34;
}
header {
display: -ms-flexbox;
display: -webkit-box;
display: flex;
background-color: #2f2f2f;
border-bottom: 1px solid #37374a
}
h1 {
color: white;
height: 40px;
line-height: 40px;
vertical-align: middle;
margin-left: 20px;
}
h2 {
-webkit-background-clip: text;
color: transparent;
background-image: linear-gradient(216deg, #c8ff40, #a7eba2, #16ac2a);
font-weight: 400;
z-index: 3;
text-align: center;
}
li {
list-style: none;
}
/* Dropdown Button */
.dropbtn {
background-color: #1b9c34;
color: white;
padding: 16px;
font-size: 16px;
border: none;
border-radius: 10%;
cursor: pointer;
background-position: center;
background-repeat: no-repeat;
background-size: 50px 50px;
padding-left: 40px;
height: 80px;
width: 100px;
}
.dropdown {
position: relative;
display: inline-block;
margin-top: 80px;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #1b9c34;
;
min-width: 140px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
z-index: 1;
}
.dropdown-content a:hover {
background-color: lightgray;
}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: lightgray;
}
.uppertext {
background-color: rgb(39, 39, 63);
display: -ms-flexbox;
display: -webkit-box;
display: flex;
-ms-flex-align: center;
-webkit-box-align: center;
align-items: center;
-ms-flex-direction: column;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
flex-direction: column;
height: 75vh;
padding-bottom: 200px;
clip-path: circle(120% at 50% -70vw);
-webkit-clip-path: circle(120% at 50% -70vw);
position: relative;
}
.bottom {
position: relative;
display: -ms-flexbox;
display: -webkit-box;
display: flex;
-ms-flex-pack: center;
-webkit-box-pack: center;
justify-content: center;
height: 62px;
min-height: 42px;
margin: 15px;
background-color: red;
}
<header>
<h1>Who is presenting?</h1>
</header>
<div class="uppertext">
<h2>Submit a conference speaker or see who is presenting
</h2>
<form action="/quotes" method="POST">
<input type="text" placeholder="name" name="name">
<input type="text" placeholder="conference" name="conference">
<input type="text" placeholder="location" name="location">
<input type="text" placeholder="date" name="date">
<button type="submit" id='submit'>Submit</button>
</form>
<div class="dropdown">
<button class="dropbtn"></button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
</div>
答
我必须改变一些CSS规则
@import url(https://fonts.googleapis.com/css?family=Catamaran);
body, html {
\t margin: 0;
\t padding: 0;
\t background-color: #aaf44d;
\t overflow: visible;
}
html {
\t font-family: "Catamaran", serif;
}
body {
\t font-family: inherit;
\t background-image: linear-gradient(216deg, #c8ff40, #a7eba2, #16ac2a);
}
textarea, select, button {
\t font-family: inherit;
}
#submit {
\t padding: 4px 10px;
\t background-color: #1b9c34;
\t border: 0 none;
\t cursor: pointer;
\t color: white;
\t -webkit-border-radius: 5px;
\t border-radius: 5px;
\t font-family: inherit;
\t font-weight: bold;
}
#submit:hover {
\t background-color: lightgray;
}
#submit:active {
\t background-color: #1b9c34;
}
body {
\t background-color: #aaf44d;
\t display: table;
\t height: 100%;
\t margin: 0;
\t overflow: visible;
\t padding: 0;
\t position: relative;
\t width: 100%;
}
header {
\t display: -ms-flexbox;
\t display: -webkit-box;
\t display: flex;
\t background-color: #2f2f2f;
\t border-bottom: 1px solid #37374a;
\t position: relative;
\t z-index: 5;
}
h1 {
\t color: white;
\t height: 40px;
\t line-height: 40px;
\t vertical-align: middle;
\t margin-left: 20px;
}
h2 {
\t -webkit-background-clip: text;
\t color: transparent;
\t background-image: linear-gradient(216deg, #c8ff40, #a7eba2, #16ac2a);
\t font-weight: 400;
\t z-index: 3;
\t text-align: center;
}
li {
\t list-style: none;
}
/* Dropdown Button */
.dropbtn {
\t background-color: #1b9c34;
\t color: white;
\t padding: 16px;
\t font-size: 16px;
\t border: none;
\t border-radius: 10%;
\t cursor: pointer;
\t background-position: center;
\t background-repeat: no-repeat;
\t background-size: 50px 50px;
\t padding-left: 40px;
\t height: 80px;
\t width: 100px;
}
.dropdown {
\t position: relative;
\t display: inline-block;
\t margin-top: 80px;
}
.dropdown-content {
\t display: none;
\t position: absolute;
\t background-color: #1b9c34;;
\t min-width: 140px;
\t box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
\t z-index: 1;
}
.dropdown-content a {
\t color: black;
\t padding: 12px 16px;
\t text-decoration: none;
\t display: block;
\t z-index: 1;
}
.dropdown-content a:hover {
\t background-color: lightgray;
}
.dropdown:hover .dropdown-content {
\t display: block;
}
.dropdown:hover .dropbtn {
\t background-color: lightgray;
}
.uppertext {
\t /*background-color: rgb(39,39,63);*/
\t display: -ms-flexbox;
\t display: -webkit-box;
\t display: flex;
\t -ms-flex-align: center;
\t -webkit-box-align: center;
\t align-items: center;
\t -ms-flex-direction: column;
\t -webkit-box-orient: vertical;
\t -webkit-box-direction: normal;
\t flex-direction: column;
\t height: calc(100vh);
\t /*padding-bottom: 200px;
\t clip-path: circle(120% at 50% -70vw);
-webkit-clip-path: circle(120% at 50% -70vw);
-moz-clip-path: circle(120% at 50% -70vw);*/
\t position: relative;
}
.uppertext:before {
\t background: rgb(39, 39, 63) none repeat scroll 0 0;
\t border-radius: 50%;
\t bottom: 0;
\t content: "";
\t height: 105%;
\t left: 0;
\t position: absolute;
\t right: 0;
\t top: -50%;
\t width: 100%;
\t z-index: 0;
}
.bottom {
\t position: relative;
\t display: -ms-flexbox;
\t display: -webkit-box;
\t display: flex;
\t -ms-flex-pack: center;
\t -webkit-box-pack: center;
\t justify-content: center;
\t height: 62px;
\t min-height: 42px;
\t margin: 15px;
\t background-color: red;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Who is presenting?</title>
<link rel="stylesheet" href="public/styles.css">
</head>
<body>
<header>
<h1>Who is presenting?</h1>
</header>
<div class = "uppertext">
<h2>Submit a conference speaker or see who is presenting<h2>
<form action="/quotes" method="POST">
<input type="text" placeholder="name" name="name">
<input type="text" placeholder="conference" name="conference">
<input type="text" placeholder="location" name="location">
<input type="text" placeholder="date" name="date">
<button type="submit" id = 'submit'>Submit</button>
</form>
<div class="dropdown">
<button class="dropbtn"></button>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</div>
</div>
</body>
</html>
+0
喜,它的作品!你能详细阐述一下变化背后的原理和原理吗?为什么它不起作用? – Yiyo
+0
当我们使用“剪辑路径”和其他相关的CSS创建一个椭圆。这意味着这个尺寸的椭圆形。而不显示夹子的外侧。像掩蔽。 – user1727852
u能更多更多的填充底部设置为您.uppertext,但这不是最好的解决办法:) – GmaSa