Header 无响应,导致按钮重叠
Header not responsive, causing overlap on buttons
我是 Web 开发的新手,正在尝试找出我的 header 遇到的问题。我希望我的 header 能够响应并且不会在其旁边的按钮元素上导致 over-lap。
我曾尝试将 position
、float
和 transform
元素分别并同时应用到 header 部分,但这似乎无法解决问题或者我只是不知道如何正确使用它们。
下面是我的 html 和 css 的示例。
HTML:
<header>
<a href="Website.html"><img id="smallLogo" src="/Users/ultimateorganism/Desktop/Brown-Dev-Proj-Vol.1/FuturUImages/smallLogo.png" alt="smallLogo"></a>
<h1 class="bizPage">FuturU</h1>
<div class="homeButtons">
<a href="Website.html" class="btn btn-outline-light" id="linkHomePage">Home</a>
<a href="Mindmovies.html" class="btn btn-outline-light" id="linkMindMovies">MindMovies</a>
<a href="mailto:pbusko5@gmail.com?subject=I am interested in an affirmation/mindmap!" class="btn btn-outline-light" id="linkContact">Contact</a>
<a href="About.html" class="btn btn-outline-light" id="linkAbout">About</a>
<a href="Testimonials.html" class="btn btn-outline-light" id="linkTestimonials">Testimonials</a>
<hr style="background-color: white; height: 3px; opacity: initial;">
</div>
<hr style="background-color: white; height: 3px; opacity: initial;">
</header>
CSS 类:
#smallLogo{
width: 110px;
height: 110px;
float: left;
}
.bizPage{
font-size: 80px;
color: white;
position: relative;
top: 30%;
left: 30%;
}
header{
background-color: black;
font-family: Courier;
justify-content: center;
}
.homeButtons{
position: absolute;
top: 32px;
right: 26px;
font-size: 8px;
}
.lineHeader, .lineFooter{
margin-left: auto;
margin-right: auto;
color: white;
height: 3px;
width: auto;
{
对此的任何解决方案将不胜感激。谢谢
基本上,如果您想做出完全响应式的 page/navbar,您可能需要使用“汉堡菜单”。看起来你已经使用了 Bootstrap。可以看到this link
不过,我正在努力提供一个可衡量的解决方案。根据需要检查代码和样式。我刚刚在 html 部分使用了 flex div。
header{
width: 100%;
}
#smallLogo{
width: 110px;
height: 110px;
/* float: left; */
}
.bizPage{
font-size: 80px;
color: white;
/* position: relative; */
top: 30%;
/* left: 30%; */
}
header{
background-color: black;
font-family: Courier;
}
.homeButtons{
/* position: absolute; */
/* top: 32px; */
/* right: 26px; */
margin-top: 1%;
font-size: 8px;
}
.lineHeader, .lineFooter{
/* margin-left: auto;
margin-right: auto; */
color: white;
height: 3px;
width: auto;
{
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Stack Overflow</title>
<link rel="stylesheet" href="style.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>
<body>
<header>
<div class="d-flex justify-content-between">
<a href="Website.html"><img id="smallLogo" src="/Users/ultimateorganism/Desktop/Brown-Dev-Proj-Vol.1/FuturUImages/smallLogo.png" alt="smallLogo"></a>
<h1 class="bizPage">FuturU</h1>
<div class="homeButtons">
<a href="Website.html" class="btn btn-outline-light" id="linkHomePage">Home</a>
<a href="Mindmovies.html" class="btn btn-outline-light" id="linkMindMovies">MindMovies</a>
<a href="mailto:pbusko5@gmail.com?subject=I am interested in an affirmation/mindmap!" class="btn btn-outline-light" id="linkContact">Contact</a>
<a href="About.html" class="btn btn-outline-light" id="linkAbout">About</a>
<a href="Testimonials.html" class="btn btn-outline-light" id="linkTestimonials">Testimonials</a>
<hr style="background-color: white; height: 3px; opacity: initial;">
</div>
</div>
<hr style="background-color: white; height: 3px; opacity: initial;">
</header>
<!-- <script type="text/javascript" src="index.js"></script> -->
</body>
</html>
让我知道它是否适合你。
我是 Web 开发的新手,正在尝试找出我的 header 遇到的问题。我希望我的 header 能够响应并且不会在其旁边的按钮元素上导致 over-lap。
我曾尝试将 position
、float
和 transform
元素分别并同时应用到 header 部分,但这似乎无法解决问题或者我只是不知道如何正确使用它们。
下面是我的 html 和 css 的示例。
HTML:
<header>
<a href="Website.html"><img id="smallLogo" src="/Users/ultimateorganism/Desktop/Brown-Dev-Proj-Vol.1/FuturUImages/smallLogo.png" alt="smallLogo"></a>
<h1 class="bizPage">FuturU</h1>
<div class="homeButtons">
<a href="Website.html" class="btn btn-outline-light" id="linkHomePage">Home</a>
<a href="Mindmovies.html" class="btn btn-outline-light" id="linkMindMovies">MindMovies</a>
<a href="mailto:pbusko5@gmail.com?subject=I am interested in an affirmation/mindmap!" class="btn btn-outline-light" id="linkContact">Contact</a>
<a href="About.html" class="btn btn-outline-light" id="linkAbout">About</a>
<a href="Testimonials.html" class="btn btn-outline-light" id="linkTestimonials">Testimonials</a>
<hr style="background-color: white; height: 3px; opacity: initial;">
</div>
<hr style="background-color: white; height: 3px; opacity: initial;">
</header>
CSS 类:
#smallLogo{
width: 110px;
height: 110px;
float: left;
}
.bizPage{
font-size: 80px;
color: white;
position: relative;
top: 30%;
left: 30%;
}
header{
background-color: black;
font-family: Courier;
justify-content: center;
}
.homeButtons{
position: absolute;
top: 32px;
right: 26px;
font-size: 8px;
}
.lineHeader, .lineFooter{
margin-left: auto;
margin-right: auto;
color: white;
height: 3px;
width: auto;
{
对此的任何解决方案将不胜感激。谢谢
基本上,如果您想做出完全响应式的 page/navbar,您可能需要使用“汉堡菜单”。看起来你已经使用了 Bootstrap。可以看到this link
不过,我正在努力提供一个可衡量的解决方案。根据需要检查代码和样式。我刚刚在 html 部分使用了 flex div。
header{
width: 100%;
}
#smallLogo{
width: 110px;
height: 110px;
/* float: left; */
}
.bizPage{
font-size: 80px;
color: white;
/* position: relative; */
top: 30%;
/* left: 30%; */
}
header{
background-color: black;
font-family: Courier;
}
.homeButtons{
/* position: absolute; */
/* top: 32px; */
/* right: 26px; */
margin-top: 1%;
font-size: 8px;
}
.lineHeader, .lineFooter{
/* margin-left: auto;
margin-right: auto; */
color: white;
height: 3px;
width: auto;
{
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Stack Overflow</title>
<link rel="stylesheet" href="style.css">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
</head>
<body>
<header>
<div class="d-flex justify-content-between">
<a href="Website.html"><img id="smallLogo" src="/Users/ultimateorganism/Desktop/Brown-Dev-Proj-Vol.1/FuturUImages/smallLogo.png" alt="smallLogo"></a>
<h1 class="bizPage">FuturU</h1>
<div class="homeButtons">
<a href="Website.html" class="btn btn-outline-light" id="linkHomePage">Home</a>
<a href="Mindmovies.html" class="btn btn-outline-light" id="linkMindMovies">MindMovies</a>
<a href="mailto:pbusko5@gmail.com?subject=I am interested in an affirmation/mindmap!" class="btn btn-outline-light" id="linkContact">Contact</a>
<a href="About.html" class="btn btn-outline-light" id="linkAbout">About</a>
<a href="Testimonials.html" class="btn btn-outline-light" id="linkTestimonials">Testimonials</a>
<hr style="background-color: white; height: 3px; opacity: initial;">
</div>
</div>
<hr style="background-color: white; height: 3px; opacity: initial;">
</header>
<!-- <script type="text/javascript" src="index.js"></script> -->
</body>
</html>
让我知道它是否适合你。