我试图解决这个问题,但找不到原因。
菜单和徽标不会相互对齐。
这是我的导航HTML:
.clear{
clear: both;
}
.tabs__item2 {
margin-bottom: 0;
position:relative;
width: 100%;
vertical-align: top;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
}
@media (max-width: 990px) {
.tabs--lg {
border: 1px solid #0A3D5D;
}
.tabs--lg .tabs__content {
border-width: 0;
border-top-width: 1px;
border-color: #0A3D5D;
}
.tabs--lg .tabs__list {
background: #0A3D5D;
margin: 0;
margin-bottom: -1px;
display: inline-block;
width: 100%;
}
.tabs--lg .tabs__list .tabs__item {
overflow: hidden;
position: absolute;
height: 0;
}
.tabs--lg .tabs__list .tabs__item--active {
height: auto;
position: relative;
}
.tabs--lg .tabs__list--open .tabs__item {
position: relative;
height: auto;
}
.tabs--lg .tabs__list--open .tabs__item--active > .tabs__link:after {
content: none;
}
.tabs--lg .tabs__item {
width: 100%;
max-width: 100%;
border-right: 0;
text-align: left;
}
.tabs--lg .tabs__item--active > .tabs__link {
background-color: #0A3D5D;
color: white;
border: 0;
}
.tabs--lg .tabs__item--active > .tabs__link:hover {
color: white;
}
.tabs--lg .tabs__item--active > .tabs__link:after {
content: "";
width: 0;
height: 0;
border: .5em solid transparent;
border-top-color: #0A3D5D;
float: right;
margin-top: .75em;
}
}
@media (max-width: 1070px) {
.tabs--xl {
border: 1px solid #0A3D5D;
}
.tabs--xl .tabs__content {
border-width: 0;
border-top-width: 1px;
border-color: #0A3D5D;
}
.tabs--xl .tabs__list {
background-color: #0A3D5D;
margin: 0;
margin-bottom: -1px;
display: inline-block;
width: 100%;
}
.tabs--xl .tabs__list .tabs__item {
overflow: hidden;
position: absolute;
height: 0;
}
.tabs--xl .tabs__list .tabs__item--active {
height: auto;
position: relative;
}
.tabs--xl .tabs__list--open .tabs__item {
position: relative;
height: auto;
}
.tabs--xl .tabs__list--open .tabs__item--active > .tabs__link:after {
content: none;
}
.tabs--xl .tabs__item {
width: 100%;
max-width: 100%;
border-right: 0;
text-align: left;
}
.tabs--xl .tabs__item--active > .tabs__link {
background-color: #0A3D5D;
color: white;
border: 0;
}
.tabs--xl .tabs__item--active > .tabs__link:hover {
color: white;
}
.tabs--xl .tabs__item--active > .tabs__link:after {
content: "";
width: 0;
height: 0;
border: .5em solid transparent;
border-top-color: #0A3D5D;
float: right;
margin-top: .75em;
}
}
.tabs__list {
margin: 0;
margin-bottom: -1px;
background: #0A3D5D;
display: flex; /* Added */
}
/*
.tabs__list {
margin: 0;
margin-bottom: -1px;
background: #0A3D5D;
}*/
.tabs__item {
padding-left:1px;
margin-bottom: 0;
display: inline-block;
width: auto;
vertical-align: top;
background: #0A3D5D;
}
/*
.tabs__item {
margin-bottom: 0;
display: inline-block;
width: auto;
vertical-align: top;
background: #0A3D5D;
}*/
.tabs__item--active > .tabs__link {
border: 1px solid #0A3D5D;
background: #0A3D5D;
border-bottom: 0;
position: relative;
z-index: 3;
color: #333333;
}
.tabs__item--active > .tabs__link:hover {
color: #262626;
}
.tabs__link {
font-weight: 500;
color: #333333;
padding: .0em 0em;
line-height: 0;
display: block;
text-decoration: none;
background: #0A3D5D;
}
.tabs__link:hover {
text-decoration: underline;
}
.tabs__area {
opacity: 0;
visibility: hidden;
-webkit-transition: opacity .5s linear;
transition: opacity .5s linear;
height: 0;
background: #0A3D5D;
}
.tabs__area--active {
opacity: 1;
visibility: visible;
-webkit-transition: opacity .5s linear;
transition: opacity .5s linear;
height: auto;
background: #0A3D5D;
}
.tabs__content {
margin-bottom: 0;
background: #0A3D5D;
border: 0px solid #0A3D5D;
overflow: hidden;
position: relative;
clear: both;
padding: 0px;
padding: 0.0rem;
}
.all {
overflow:hidden;
border: 2px solid #006699;
background-color: #0F3053;
}
#root { max-width: 1200px; margin: 0 auto;
background-color:#0F3053;}
#box1 { width: 100%;
background-color:#0F3053; padding:0px 2px 0px 2px;}
#box2 { width: 50%; background-image:url('https://freephonewallpapersformobile.files.wordpress.com/2015/11/header-logo1.jpg');
background-repeat:no-repeat;
background-size:contain;
background-position: left;
-webkit-background-size:contain;
-moz-background-size:contain;
-o-background-size:contain;
height:188px;
}
#box3 { width: 50%;
background-color:#0F3053;
}
#box4 { width: 20%; }
#box5 { width: 60%;
background-color:#0F3053;padding-right:10px; padding-left:10px;}
#box6 { width: 40%; padding-right:10px;
margin: 0 auto; background-color:#0F3053;}
#box7 { width: 100%; }
.border {
border: 1px solid #006699;
border-bottom-right-radius:8px;
border-bottom-left-radius:8px;
border-top-right-radius:8px;
border-top-left-radius:8px;
overflow:hidden;}
.container-dock {
padding: 0rem;
max-width:700px;
margin: auto;
background: #0A3D5D;
}
.cats {
width: 100%;
height: auto;}
.c1, .c2, .c3, .c4, .c5
{background-image: url('https://freephonewallpapersformobile.files.wordpress.com/2015/07/dock-cat-sprite1.png');
background-repeat: no-repeat;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
display:inline-block;
width:50px;
height:50px;
outline:none;
}
.c1 {background-position: 0px 0px;}
.c2 {background-position: 0px -52px;}
.c3 {background-position: 0px -104px;}
.c4 {background-position: 0px -156px;}
.c5 {background-position: 0px -208px;}
.d1, .d2, .d3, .d4, .d5, .d6
{background-image: url('https://freephonewallpapersformobile.files.wordpress.com/2015/07/desktop-sprite2.png');
background-repeat: no-repeat;
width:100px;
height:56px;
border: 0;
width:100px;
height:56px;
outline:none;
display:inline-block;
}
.d1 {background-position: 0px 0px;}
.d2 {background-position: 0px -58px;}
.d3 {background-position: 0px -122px;}
.d4 {background-position: 0px -180px;}
.d5 {background-position: 0px -238px;}
.d6 {background-position: 0px -296px;}
.m1, .m2, .m3, .m4, .m5, .m6
{background-image: url('https://freephonewallpapersformobile.files.wordpress.com/2015/07/mobile-sprite11.png');
background-repeat: no-repeat;
display:inline-block;
border: 0;
width:100px;
height:56px;
outline:none;
}
.m1 {background-position: 0px 0px;
}
.m2 {background-position: 0px -58px;
}
.m3 {background-position: 0px -116px;
}
.m4 {background-position: 0px -174px;
}
.m5 {background-position: 0px -232px;
}
.m6 {background-position: 0px -290px;
}
.main {
padding:0px 0px 0px 0px;
}
.top_grow11{
float: left;
margin-right: 0px;
width: auto;
height: 100%;
}
<div class=all>
<div id='root'>
<div class='box' id='box2'></div>
<div class='box' id='box3'>
</div>
<div class='box' id='box5'><div class='main'>
<div class="border">
<div class="container-dock">
<div class="tabs tabs--md">
<ul class="tabs__list list-unstyled">
<li class="tabs__item tabs__item--active">
<a href="#tab-1" class="tabs__link">
<img class="c1"></a> </li>
<li class="tabs__item">
<a href="#tab-3" class="tabs__link">
<img class="c2"></a></li>
<li class="tabs__item">
<a href="#tab-2" class="tabs__link"><img class="c3"></a>
</li>
<li class="tabs__item">
<a href="#tab-4" class="tabs__link"><img class="c4"></a></li>
<li class="tabs__item fill">
<img class="c5">
</li>
</ul><div class="tabs__content">
<div id="tab-1" class="tabs__area tabs__area--active">
<div class="top_grow11">
<a href="http://www.techagesite.com/hd-wii-wallpapers-mario-kart-super-mario-galaxy-2.htm">
<img class="d1"></img>
</a>
</div>
<div class="top_grow11">
<a href="http://www.techagesite.com/free-music-wallpaper-big-music-wallpapers.htm">
<img class="d2"></img>
</a>
</div>
<div class="top_grow11">
<a href="http://www.techagesite.com/awesome-minecraft-hd-desktop-wallpapers-1080p-backgrounds-1920x1080.htm">
<img class="d3"></img>
</a>
</div>
<div class="top_grow11">
<a href="scooby-doo-wallpapers-character-backgrounds-coloring-pages-the-gang.htm">
<img class="d4"></img>
</a>
</div>
<div class="top_grow11">
<a href="free-hd-neon-colours-desktop-wallpapers-download.htm">
<img class="d5"></img>
</a>
</div>
<div class="top_grow11">
<a href="cool-hd-desktop-wallpapers-1920x1080.htm">
<img class="d6"></img></a></div></div>
<div id="tab-2" class="tabs__area">
<div class="top_grow11">
<a href="facebook-timeline-covers-photos-851x315.htm">
<img class="cats" src="thumbs/fb-cover_small.jpg"></img>
</a></div>
</div>
<div id="tab-3" class="tabs__area"><div class="top_grow11">
<a href="hd-minecraft-mobile-phone-wallpapers-1080x1920-steve-creeper.htm">
<img class="m1"></img></a>
</div>
<div class="top_grow11">
<a href="hd-disney-frozen-wallpapers-for-mobile-phones-1080x1920.htm">
<img class="m2"></img></a>
</div>
<div class="top_grow11">
<a href="legend-of-zelda-ocarina-of-time-mobile-phone-wallpapers.htm">
<img class="m3"></img></a>
</div>
<div class="top_grow11">
<a href="hd-super-mario-bros-world-mobile-phone-wallpapers-1080x1920.htm">
<img class="m4"></img></a>
</div>
<div class="top_grow11">
<a href="lg-g2-g3-htc-one-max-s-m8-mobile-phone-wallpapers.htm">
<img class="m5"></img></a>
</div>
<div class="top_grow11">
<a href="android-hd-mobile-phone-wallpapers-1080x1920.htm">
<img class="m6"></img></a></div></div><div id="tab-4" class="tabs__area">
<div class="top_grow11"><a href="twitter-headers-and-background-covers-1500x500.htm">
<img class="cats" src="thumbs/caterpillar.png"></a>
</div></div>
<div id="tab-5" class="tabs__area">
</div> <div id="tab-6" class="tabs__area"> </div></div>
</div>
</div></div><!----><div class="clear"></div>
</div> <div class="clear"></div>
</div></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
var app = {};
app.tabs = (function() {
var module = {};
module.init = function() {
var $tabs = $('.tabs');
var $tabList = $('.tabs__list');
var $tabItem = $('.tabs__item');
var $tabItemActive = $('.tabs__item--active');
var $tabLink = $('.tabs__link');
var width = $(window).width();
var tabSwitcher = function() {
// On tab link click
$tabLink.on('click', function(e) {
var currentAttrValue = jQuery(this).attr('href');
// Show/Hide Tabs
$('.tabs ' + currentAttrValue).addClass('tabs__area--active').siblings().removeClass('tabs__area--active')
// Change/remove current tab to active
$(this).parent('li').addClass('tabs__item--active').siblings().removeClass('tabs__item--active');
e.preventDefault();
});
}
var tabToggle = function() {
$tabItem.on('click', function(e) {
$(this).parent($tabList).toggleClass('tabs__list--open');
});
}
var tabController = function() {
tabToggle();
}
$(window).resize(function() {
var width = $(window).width();
if ($(window).width() != width) {
width = $(window).width();
tabController();
}
});
tabController();
tabSwitcher();
};
return module;
})();
app.tabs.init();
正如您所看到的那样,品牌和菜单看起来不太好,因为它不会彼此相邻。
您可以在这里查看JSFIDDLE:https://jsfiddle.net/683onLeg/
答案 0 :(得分:1)
你有一个关于ul的全局课程,它会在任何ul的顶部增加40px的余量。如果删除或覆盖该规则,一切看起来都不错。
答案 1 :(得分:1)
使用此样式,它将对齐并将其正好放在菜单栏的中间
ul.navbar-nav{
margin-top: 0;
}
ul.navbar-nav li a{
line-height: 24px !important;
}
答案 2 :(得分:0)
如上所述,有一种毯子式样式如下:
ul {
margin-top: 40px;
}
删除该样式,这可能会弄乱其他<ul>
在布局中的显示方式,或者通过指定ul.navbar-nav
类来覆盖ul.navbar-nav {
margin-top: 0;
}
类的边距:
SELECT tablesite.name,
tablesite.family,
tablesite.phone_number,
COUNT(action.service_provider_id)
FROM tablesite
LEFT JOIN action
ON tablesite.id_user=action.service_provider_id and action.vote !='' AND action.customer_comment =''
GROUP BY name, family, phone_number