[英]Having issues aligning logo with H1 and H2 in header
I can't figure out why my logo img is leaking into my navigation and not aligning.我无法弄清楚为什么我的徽标 img 会泄漏到我的导航中并且没有对齐。 I need the logo to align with the h1 and h2 in my header.我需要徽标与 header 中的 h1 和 h2 对齐。 It currently looks like this:它目前看起来像这样:
Here is my html:这是我的 html:
<body>
<div id="headerWrapper">
<header>
<img src="images/logopracticedone.png" alt="">
<h1>Science Museum</h1>
<h2>A Celebration of Technology & Mechanics</h2>
</header>
</div>
<div id="navWrapper">
<nav class="clearfix">
<ul>
<li class="active"><a href="index.html">Visit Us</a></li>
<li><a href="#">See and Do</a></li>
<li><a href="#">Learning</a></li>
<li><a href="#">Education</a></li>
</ul>
</nav>
</div>
Here is my SCSS:这是我的 SCSS:
body {
font-family: $fontFamily;
font-size: 16px;
font-weight: $regularWeight;
}
header {
img { max-width: 100%;
max-height: 100%;
float: left;}
padding: 1rem $gutter;
h1 {
margin: 0;
font-size: 1.5rem;
font-weight: $semiBold;
} //end of h1
h2{
margin: 0;
font-size: 1.2rem;
font-weight: $regularWeight;
} //end of h2
} //end of header
img
从img
中删除浮动height
in css of img
to fit according to your design.根据您的设计调整img
的 css 中的height
以适合您的设计。display
inline-block
for both the new div
and img
为新的div
和img
制作display
inline-block
<img src="images/logopracticedone.png" alt="">
<div>
<h1>Science Museum</h1>
<h2>A Celebration of Technology & Mechanics</h2>
<div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.