我正在尝试为网站标题/导航的样式证明有点棘手。我有一个PSD图像它需要如何看 - CSS - 样式化标题/导航
我很好的标志,但我正在努力与如何适应所有其他元素在彼此的右侧。通常我只有徽标和导航链接。下面的代码 -
HTML
<header>
<h1 id="logo">
<img src="images/Logo.png">
</h1>
<div id="phoneandemail">
<h3>
<img src="images/phone.png" alt="phone" >
<p>0113 220 5265</p>
</h3>
<h3>
<img src="images/email.png">
<p>[email protected]</p>
</h3>
</div>
<nav>
<a href="index.html">HOME</a>
<a href="portfolio.html">PORTFOLIO</a>
<a href="products.html">PRODUCTS</a>
<a href="about.html">ABOUT</a>
<a href="contact.html">CONTACT</a>
<a href="blog.html">BLOG</a>
</nav>
<h3>
<i class="fa fa-facebook" aria-hidden="true"></i>
<i class="fa fa-twitter" aria-hidden="true"></i>
<i class="fa fa-instagram" aria-hidden="true"></i>
<i class="fa fa-youtube-play" aria-hidden="true"></i>
<i class="fa fa-linkedin" aria-hidden="true"></i>
</h3>
</header>
我使用重置&骨架CSS网格旁边我的CSS。这里就是我这么远 -
CSS
header {
background: #ffffff;
height: 100px;
position: fixed;
width: 100%;
top: 0;
box-shadow: 0 0 10px rgba(0,0,0,0.25);
z-index: 10;
}
nav {
float: right;
line-height: 50px;
font-weight: 400;
}
nav a {
color: #bdc3c7;
text-decoration: none;
display: inline-block;
padding: 0 10px 0 10px;
}
#phoneandemail {
float: right;
height: 10px;
width: 200px;
}
h3 i {
float: right;
}
我需要把它们飘浮没事还是有一个更合适的方式将它们全部组合在一起,如PSD图片?我需要尽可能地接近它。
你在挣扎?那些社交标志在右边? –
你应该把它看作一个网格。首先要做的是:制作两部分。左侧(带有徽标)和右侧与导航。因此,你需要两个div(左标题,右标题)。将它们都浮在左边,以便它们在同一行上。 (不要忘记把它们放在一个容器中,这样它们保持相同的高度)。 左侧部分(标志)不是问题,所以我专注于正确的部分。再次将它分成一个网格。首先再次制作两个div(一个用于顶部,另一个用于底部)。继续这样做,直到你有你需要的。 – JeroenE
@RohitJaiswal是的,我无法让他们像上面的图像一样围绕彼此。 –