完成我的汉堡菜单并将其设置为仅在屏幕的最大宽度为600px时显示,这些链接不会彼此位于下方,它们会彼此对齐,并且无法单击大多数他们也是。
在最小化页面时,我可以添加哪些代码使它们更整洁? 附上我的代码以供参考...谢谢!
<nav role="navigation" class="nav">
<input class="trigger" type="checkbox" id="mainNavButton">
<label for="mainNavButton" onclick></label>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="classes.html">Classes</a>
<ul>
<li><a href="musicaltheatre.html">Musical Theatre</a></li>
<li><a href="afterschool.html">After School</a></li>
<li><a href="holidayprogrammes">HolidayProgrammes</a>
</ul>
<li><a href="blog.html">Blog</a></li>
<li><a href="events.html">Events</a></li>
<li><a href="about.html">About</a></li>
<li><a href="where.html">Where</a></li>
<li><a href="register.html">Register</a></li>
</ul>
<figcaption>
<p>Welcome!</p>
</figcaption>
</nav>
<div class="logo"><a href="index.html"><img src="assets/images/maridrama_logo.png" class="centre"></a></div>
</div>
.nav{
width: 100%;
height: 100vh;
background: url(assets/images/matthijs-smit-574921-unsplash.jpg);
background-size: cover;
background-position: center;
}
.nav{
background: background: url(assets/images/matthijs-smit-574921-unsplash.jpg);
}
.nav figcaption {
padding: 10em;
-webkit-transition: background-color 0.35s;
transition: background-color 0.35s;
}
.nav figcaption::before {
position: absolute;
top: 100px;
right: 30px;
bottom: 30px;
left: 30px;
border: 1px solid #fff;
content: '';
}
.nav figcaption::before,
.nav p {
text-align: left;
font-size: 40px;
font-family: "Franklin Gothic Demi Cond";
font-weight: bold;
opacity: 0;
-webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
transition: opacity 0.35s, transform 0.35s;
-webkit-transform: scale(0);
transform: scale(0);
}
.nav:hover figcaption::before,
.nav:hover p {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1);
}
.nav:hover figcaption {
background-color: rgba(58,52,42,0);
}
body {
-webkit-animation: bugfix infinite 1s;
}
@-webkit-keyframes bugfix {
from {
padding: 0;
}
to {
padding: 0;
}
}
/* needed for checkbox hack */
h1, p {
color: white;
}
.nav ul {
display: none;
width: 80%;
height: 70px;
float: right;
list-style: none;
margin: 0px;
padding: 0px;
}
.nav ul li a {
display: block;
padding: 0;
text-decoration: none;
color: #fff;
font-weight: bold;
width: 150px;
}
.nav ul li a:hover {
background: #96C7ED;
transition: all ease;
}
.nav ul li:last-of-type a {
border-right: 0px;
}
.nav ul li ul li a {
padding-left: 2px;
}
.nav ul li ul li ul li a {
padding-left: 3.125em;
margin-bottom: 20px;
}
.nav input.trigger {
position: absolute;
top: -9999px;
left: -9999px;
}
.nav input.trigger:checked ~ ul, .nav input.trigger:checked ~ ul li ul {
display: block !important;
}
@media (max-width: 600px) {
.nav input.trigger:checked ~ ul, .nav input.trigger:checked ~ ul li ul {
display: -webkit-box;
display: -moz-box;
display: box;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
box-orient: horizontal;
display: flex;
flex-direction: row;
}
}
.nav label {
position: relative;
display: block;
min-height: 2em;
padding: .45em;
font-size: 1.1em;
margin: 0;
cursor: pointer;
background: #96C7ED;
line-height: 2em;
color: #bfe1fb;
}
.nav label:after {
position: absolute;
right: 1em;
top: .2em;
content: "\2261";
font-size: 1.8em;
color: white;
}
@media (min-width: 48em) {
.nav ul {
display: -ms-flexbox;
flex-direction: -ms-row;
display: -webkit-box;
display: -moz-box;
display: box;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
box-orient: horizontal;
display: flex;
flex-direction: row;
}
.nav ul li {
float: right;
width: 100%;
font-size: 15px;
line-height: 65px;
text-align: center;
position: relative;
text-align: center;
-ms-flex: 1;
-webkit-box-flex: 1;
-moz-box-flex: 1;
box-flex: 1;
flex: 1;
}
.nav ul li ul {
display: none !important;
position: absolute;
right: 0px;
left: 0;
text-align: center;
z-index: 200;
}
.nav ul li ul li {
text-align: center;
height: 65px;
}
.nav ul li ul li ul {
z-index: 300;
top: 0px;
left: 12.4em;
}
.nav ul li ul li ul li a {
padding-left: 30px !important;
}
.nav ul li:hover > ul {
display: block !important;
}
.nav label {
display: none;
}
}
答案 0 :(得分:0)
`fdfd`
enter code here bfb fbfb fgf di v and s exc ruinnd dsjbjcjnc sndb
.master-grid {
display: grid;
box-shadow: 1px 4px 4px black;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
grid-template-rows: repeat(auto-fit, minmax(70px, 1fr));
grid-template-areas:
"header header header header"
"sidebar sidebar sidebar sidebar"
"content content content content"
"footer footer footer footer";
}
.content {
grid-area: content;
justify-content:center;
background: rgb(255, 255, 255);
background: linear-gradient(
270deg,
rgba(255, 255, 255, 0.11808473389355745) 0%,
rgba(255, 255, 255, 0.7903536414565826) 10%,
rgba(168, 168, 168, 1) 100%);
padding: 1rem;
}
text align center
答案 1 :(得分:0)
`fdfd`
enter code here bfb fbfb fgf di v and s exc ruinnd dsjbjcjnc sndb
.master-grid {
display: grid;
box-shadow: 1px 4px 4px black;
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
grid-template-rows: repeat(auto-fit, minmax(70px, 1fr));
grid-template-areas:
"header header header header"
"sidebar sidebar sidebar sidebar"
"content content content content"
"footer footer footer footer";
}
.content {
grid-area: content;
justify-content:center;
background: rgb(255, 255, 255);
background: linear-gradient(
270deg,
rgba(255, 255, 255, 0.11808473389355745) 0%,
rgba(255, 255, 255, 0.7903536414565826) 10%,
rgba(168, 168, 168, 1) 100%);
padding: 1rem;
}