简体   繁体   English

影响导航栏和滑块的CSS

[英]CSS affecting nav bar and slider

Basically the problem I am having is that I have some CSS that is affecting both my nav bar and slider, because they are both using and essentially the nav bar is working but the slider is being affected. 基本上,我遇到的问题是我有一些CSS会影响我的导航栏和滑块,因为它们都在使用并且本质上导航栏正在工作,但滑块受到了影响。

I am still pretty new to coding so I didn't know what specifically to search online to fix this problem, any help is greatly appreciated. 我对编码还是很陌生,所以我不知道专门为解决此问题而在网上进行搜索,非常感谢您的帮助。

HTML being affected. HTML受到影响。

 <div class="flexslider"> <ul class="slides"> <li> <img src="img/barber4.jpg" alt="" style="margin:0; padding:0;display:block;"> </li> <li> <img src="img/menuew-2.jpg" alt="" style="margin:0; padding:0;display:block;"> </li> </ul> </div> 
 NAV BAR <!--section1--> <section id="top" class="Back to top"> <img alt="" style="position: absolute;left:312px;width:1280px;" width="1599" height="276" src="img/borderblacktop.png"> <div class="top-bar-container"> <div class="top-bar"> </div> <nav class="nav-bar"> <ul> <li><a href="#content" class="selected">About</a></li> <li><a href="#photos" >Gallery</a></li> <li><a href="#menu">Menu</a></li> <li><a href="#contact">Contact</a></li> </ul> </nav> </div> <div class="header-container"> <div class="header"> </h3> <h4> 

NAV BAR CSS: 导航栏CSS:

 .top-bar-container .top-bar { width: 800px; } .top-bar-container .top-bar .logo { float: left; } .top-bar-container .top-bar .logo span { color: #27AD60; } .top-bar-container .nav-bar { float: right; } .top-bar-container .nav-bar ul li { list-style-type: none; display: inline-block; padding: 21px 27px; font-size:15px; } .top-bar-container .nav-bar ul li a:not(.active) { text-decoration: none; color: white; } .top-bar-container .nav-bar .active { color: white; text-decoration: none; padding-top:34px; } ul { list-style: none; } ul li { display: inline-block; } ul li a { display: block; padding: 16px; color: grey; text-decoration: none; position: relative; } ul li a:hover, ul li a.selected{ color:white; } ul li a.selected:before, ul li a:hover:before { content: ''; width: 100%; position: absolute; top: -19px; left: 0; height: 3px; background: white; } h3{ font-size: 121.5%; line-height: 2.; font-family: 'PT Sans', sans-serif; text-align: center; } 

Your issue is that the CSS selectors are not descriptive enough. 您的问题是CSS选择器的描述性不足。 ul and li will target both HTML sections. ulli将同时定位两个HTML部分。

You can change them to classes or ids so that the selectors are more descriptive. 您可以将它们更改为类或ID,以便选择器更具描述性。

I would recommend reading up on CSS selectors as it will make HTML and CSS a lot easier. 我建议阅读CSS选择器,因为它会使HTML和CSS更加容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM