我试图添加徽标而不是' Home'。尝试了很多东西。我在哪里实现这个? #nav内?还是分开?还试图让这个导航栏粘住,不会在以下部分重叠或在较小的屏幕上保持可见。也许这在一个问题中有点多了。
我的HTML:
<!-- Header -->
<div id="header">
<!-- Logo -->
<h1 hidden><a href="index.html" id="logo">Helios <em>Solutions</em></a></h1>
<nav id="nav">
<ul>
<li class="current" id="titlehome"><a href="index.html">Helios Solutions</a></li>
<li>
<a href="left-sidebar.html">Ons zorgaanbod</a>
<ul>
<li><a href="#">Dienst 1</a></li>
<li><a href="#">Dienst 2</a></li>
<li><a href="#">Dienst 3</a></li>
<li><a href="#">Cliënten aan het woord</a></li>
</ul>
</li>
<li>
<a href="left-sidebar.html">Over Helios Solutions</a>
<ul>
<li><a href="#">Onze missie</a></li>
<li><a href="#">Onze werkwijze</a></li>
<li><a href="#">Ons team</a></li>
<li><a href="#">Vacatures</a></li>
</ul>
</li>
<li>
<a href="left-sidebar.html">Voor cliënten</a>
<ul>
<li><a href="#">Uw privacy</a></li>
<li><a href="#">Uw klachten</a></li>
<li><a href="#">Onze cliëntenraad</a></li>
</ul>
</li>
<li><a href="#contact" class="smoothScroll">Contact</a></li>
<li><a href="tel:+31505731019">050 573 10 19</a></li>
</ul>
</nav>
</div>
</div>
我的CSS:
/ *标题* /
#header {
padding: 0 0 0 0;
background-color: #1176C0;
background-image: url("images/bg02.png"), url("images/bg02.png"), url("images/bg01.png");
background-position: top left, top left, top left;
background-size: 0% 0, 0% 0, auto;
background-repeat: no-repeat, no-repeat, repeat;
}
#header h1 {
padding: 0 0 0 0;
margin: 0;
}
#header h1 a {
font-size: 1.5em;
letter-spacing: -0.025em;
border: 0;
}
/ *导航* /
#nav {
cursor: default;
background-color: #1176C0;
background-image: -moz-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.3)), url("images/bg01.png");
background-image: -webkit-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.3)), url("images/bg01.png");
background-image: -ms-linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.3)), url("images/bg01.png");
background-image: linear-gradient(top, rgba(0,0,0,0), rgba(0,0,0,0.3)), url("images/bg01.png");
padding: 0;
}
#nav:after {
content: '';
display: block;
width: 100%;
height: 0.6em;
background-color: #fff;
}
#nav > ul {
margin: 0;
font-weight: bold;
}
#nav > ul > li {
position: relative;
display: inline-block;
margin-left: 1em;
}
#nav > ul > li a {
color: #fff;
text-decoration: none;
border: 0;
display: block;
padding: 1.5em 0.5em 1.35em 0.5em;
}
#nav > ul > li:first-child {
margin-left: 0;
}
#nav > ul > li:hover a {
color: #F09200;
font-weight: 600;
}
#nav > ul > li.current {
}
#nav > ul > li.current:before {
-moz-transform: rotateZ(45deg);
-webkit-transform: rotateZ(45deg);
-ms-transform: rotateZ(45deg);
transform: rotateZ(45deg);
width: 0.6em;
height: 0.6em;
content: '';
display: block;
position: absolute;
bottom: -0.4em;
left: 50%;
margin-left: -0.375em;
background-color: #fff;
}
#nav > ul > li.current a {
color: #fff;
}
#nav > ul > li.active a {
color: #fff;
}
#nav > ul > li.active.current:before {
opacity: 0;
}
#nav > ul > li > ul {
display: none;
}
我的JS:
(function($) {
skel.breakpoints({
wide: '(max-width: 1680px)',
normal: '(max-width: 1280px)',
narrow: '(max-width: 980px)',
narrower: '(max-width: 840px)',
mobile: '(max-width: 736px)',
mobilep: '(max-width: 480px)'
});
$(function() {
var $window = $(window),
$body = $('body');
// Disable animations/transitions until the page has loaded.
$body.addClass('is-loading');
$window.on('load', function() {
$body.removeClass('is-loading');
});
// Fix: Placeholder polyfill.
$('form').placeholder();
// Prioritize "important" elements on narrower.
skel.on('+narrower -narrower', function() {
$.prioritize(
'.important\\28 narrower\\29',
skel.breakpoint('narrower').active
);
});
// Dropdowns.
$('#nav > ul').dropotron({
offsetY: -15,
hoverDelay: 0,
alignment: 'center'
});
// Off-Canvas Navigation.
// Title Bar.
$(
'<div id="titleBar">' +
'<a href="#navPanel" class="toggle"></a>' +
'<span class="title">' + $('#logo').html() + '</span>' +
'</div>'
)
.appendTo($body);
// Navigation Panel.
$(
'<div id="navPanel">' +
'<nav>' +
$('#nav').navList() +
'</nav>' +
'</div>'
)
.appendTo($body)
.panel({
delay: 500,
hideOnClick: true,
hideOnSwipe: true,
resetScroll: true,
resetForms: true,
side: 'left',
target: $body,
visibleClass: 'navPanel-visible'
});
// Fix: Remove navPanel transitions on WP<10 (poor/buggy performance).
if (skel.vars.os == 'wp' && skel.vars.osVersion < 10)
$('#titleBar, #navPanel, #page-wrapper')
.css('transition', 'none');
});
})(jQuery);
答案 0 :(得分:0)
直接在导航开始标记之后或导航结束标记之前粘贴下一行,具体取决于您是否希望徽标在导航栏上左移或右移。
<a class="navbar-brand" href="path-to-root"><img src="path-to-logo"></a>
应该在导航栏上为您提供徽标。 希望这会有所帮助。
(navbar-brand是引导程序类,但是如果您不使用引导程序,则可以使用该类在自己的CSS中设置徽标样式)